raise syntax error from lexer parser with utf8 character

This commit is contained in:
Michael Go
2024-10-29 22:04:37 -03:00
parent 1943441361
commit 8a9f33a060
2 changed files with 20 additions and 2 deletions
+11
View File
@@ -84,4 +84,15 @@ class LexerUnitTest < Minitest::Test
tokens = Lexer.new("foo > 12").tokenize
assert_equal([[:id, 'foo'], [:comparison, '>'], [:number, '12'], [:end_of_string]], tokens)
end
def test_error_with_utf8_character
error = assert_raises(SyntaxError) do
Lexer.new("1 < 1Ø").tokenize
end
assert_equal(
'Liquid syntax error: Unexpected character Ø',
error.message,
)
end
end