summaryrefslogtreecommitdiffhomepage
path: root/tests/00_syntax
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2020-11-30 19:23:01 +0100
committerJo-Philipp Wich <jo@mein.io>2020-11-30 19:23:01 +0100
commit7caf3331ba7d8f0dd91659e4001c9d8256bf4558 (patch)
treeba6a32a3eb675fca44f0fc50d280037f1e70a4df /tests/00_syntax
parentb94c01f29408600721c7e3302392e9015fc7bafd (diff)
syntax: fix quirks when parsing octal sequences
- Eliminate dead code left after regex literal parsing changes - Properly handle short octal sequences at end of string Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'tests/00_syntax')
-rw-r--r--tests/00_syntax/09_string_literals15
1 files changed, 11 insertions, 4 deletions
diff --git a/tests/00_syntax/09_string_literals b/tests/00_syntax/09_string_literals
index 381076e..0967850 100644
--- a/tests/00_syntax/09_string_literals
+++ b/tests/00_syntax/09_string_literals
@@ -28,16 +28,23 @@ Octal escape: ABC xyz
Testing various parsing corner cases.
-- Expect stdout --
-[ "\t", "\n", "y" ]
+[ "\t", "\n", "y", "\u0001", "\n", "\u0001\u0002", "\u0001\u0002", "\u0001\u0002", "\u0001a", "\na" ]
-- End --
-- Testcase --
{%
print([
- "\ ", // properly handle escaped tab
+ "\ ", // properly handle escaped tab
"\
-", // properly handle escaped newline
- "\y" // substitute unrecognized escape with escaped char
+", // properly handle escaped newline
+ "\y", // substitute unrecognized escape with escaped char
+ "\1", // handle short octal sequence at end of string
+ "\12", // handle short octal sequence at end of string
+ "\1\2", // handle subsequent short octal sequences
+ "\001\2", // handle short sequence after long one
+ "\1\002", // handle long sequence after short one
+ "\1a", // handle short octal sequence terminated by non-octal char
+ "\12a" // handle short octal sequence terminated by non-octal char
], "\n");
%}
-- End --