From 344df13ec65a81661ae00ca11199ed63985db4dc Mon Sep 17 00:00:00 2001 From: Ramon Torres Date: Wed, 21 Feb 2024 13:31:01 -0500 Subject: [PATCH] Test unicode char parsing error (#4) --- test/test_parser.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/test_parser.rb b/test/test_parser.rb index b7daee7..d8e827b 100644 --- a/test/test_parser.rb +++ b/test/test_parser.rb @@ -47,4 +47,13 @@ def test_raises_error_if_low_surrogate_is_not_formatted_correctly assert_equal "Unexpected character '$', expecting 'U' at line 1, column 17 (offset: 16)", error.message end + + def test_raises_error_if_unicode_sequence_contains_invalid_characters + parser = DotStrings::Parser.new + error = assert_raises DotStrings::ParsingError do + parser << '"key" = "\UD83Z";' + end + + assert_equal "Unexpected character 'Z', expecting a hex digit at line 1, column 15 (offset: 14)", error.message + end end