diff --git a/crates/improvise-core/src/format.rs b/crates/improvise-core/src/format.rs index ef5dfb60..cbc1909a 100644 --- a/crates/improvise-core/src/format.rs +++ b/crates/improvise-core/src/format.rs @@ -131,6 +131,15 @@ mod tests { assert_eq!(parse_number_format(",.999f"), (true, 0)); } + /// `format:` is `rest_of_line` in the grammar, so the format string can hold + /// any text at all — including a multibyte char right after the dot. + #[test] + fn a_multibyte_character_after_the_dot_does_not_split_a_char_boundary() { + assert_eq!(parse_number_format(",.2\u{20ac}"), (true, 2)); + assert_eq!(parse_number_format(".\u{20ac}"), (false, 0)); + assert_eq!(parse_number_format(".\u{0662}"), (false, 0)); + } + #[test] fn a_format_naming_no_precision_at_all_reads_as_zero() { assert_eq!(parse_number_format(",f"), (true, 0));