From 37ea590bd3544ca7ed4f181b37fe3622abaeada0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sat, 21 Nov 2026 12:20:02 +0100 Subject: Properly report invalid UTF-8 encoding --- test/asset/parser/invalid-utf8.et | 4 ++++ test/asset/parser/utf8.et | 4 ++++ test/script/parser.et | 5 +++++ 3 files changed, 13 insertions(+) create mode 100644 test/asset/parser/invalid-utf8.et create mode 100644 test/asset/parser/utf8.et (limited to 'test') diff --git a/test/asset/parser/invalid-utf8.et b/test/asset/parser/invalid-utf8.et new file mode 100644 index 0000000..7f6b4fd --- /dev/null +++ b/test/asset/parser/invalid-utf8.et @@ -0,0 +1,4 @@ +# Script with invalid UTF-8: the byte 0xE9 is Latin-1 é, not valid UTF-8 +test Test: + let x = "café" + guard (x == x) diff --git a/test/asset/parser/utf8.et b/test/asset/parser/utf8.et new file mode 100644 index 0000000..d0c06e1 --- /dev/null +++ b/test/asset/parser/utf8.et @@ -0,0 +1,4 @@ +# Script with valid non-ASCII UTF-8 content: Šíleně žluťoučký kůň … +test Test: + let x = "… úpěl ďábelské ódy “‘quoted’”" + guard (x == x) diff --git a/test/script/parser.et b/test/script/parser.et index 5c45876..5843afe 100644 --- a/test/script/parser.et +++ b/test/script/parser.et @@ -22,3 +22,8 @@ test Parser: expect_load_failure using p of "function-fail" giving "parse-error" expect_load_success using p of "tags" expect_load_success using p of "type-annotation" + +test ParseUtf8: + spawn as p + expect_load_success using p of "utf8" + expect_load_failure using p of "invalid-utf8" giving "parse-error" -- cgit v1.2.3