summaryrefslogtreecommitdiffhomepage
path: root/tests/00_syntax/09_string_literals
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2020-11-30 17:38:50 +0100
committerJo-Philipp Wich <jo@mein.io>2020-11-30 17:38:50 +0100
commitac5cb8736f89f8da0c1bbe407d7d4ae9df530a5c (patch)
tree8e1f0a1e5e1bcde78f275839fb109e3eaf9bdb7b /tests/00_syntax/09_string_literals
parentf7b079ce3a41a0f92adb623b0de10419fc9f5df9 (diff)
syntax: fix string and regex literal parsing quirks
- Do not interprete escape sequences in regexp literals - Do not improperly substitute control escape sequences such as `\n` or `\a` after a backslash Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'tests/00_syntax/09_string_literals')
-rw-r--r--tests/00_syntax/09_string_literals18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/00_syntax/09_string_literals b/tests/00_syntax/09_string_literals
index cd84d3e..381076e 100644
--- a/tests/00_syntax/09_string_literals
+++ b/tests/00_syntax/09_string_literals
@@ -23,3 +23,21 @@ Octal escape: ABC xyz
{{ "Octal escape: \101\102\103 \170\171\172" }}
{{ { "Single char escape": "\a\b\e\f\r\t\v\\\n" } }}
-- End --
+
+
+Testing various parsing corner cases.
+
+-- Expect stdout --
+[ "\t", "\n", "y" ]
+-- End --
+
+-- Testcase --
+{%
+ print([
+ "\ ", // properly handle escaped tab
+ "\
+", // properly handle escaped newline
+ "\y" // substitute unrecognized escape with escaped char
+ ], "\n");
+%}
+-- End --