summaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2022-10-08 01:15:16 +0200
committerGitHub <noreply@github.com>2022-10-08 01:15:16 +0200
commit1712e771b92b08d9f46b23a136cfd2bde877b71b (patch)
treebc2f084916c574acb4c6e10ddf5146a796c4b7f7 /tests
parentf8e00b4b83dad76e183b8293870cfe3110f1fa94 (diff)
parent21ace5e5c7c98271d78ff9cdf2b61e3ac70704d8 (diff)
Merge pull request #113 from jow-/fix-regex-literal-parsing
lexer: fixes for regex literal parsing
Diffstat (limited to 'tests')
-rw-r--r--tests/custom/00_syntax/21_regex_literals29
1 files changed, 28 insertions, 1 deletions
diff --git a/tests/custom/00_syntax/21_regex_literals b/tests/custom/00_syntax/21_regex_literals
index 7466a2e..44f0079 100644
--- a/tests/custom/00_syntax/21_regex_literals
+++ b/tests/custom/00_syntax/21_regex_literals
@@ -4,7 +4,7 @@ within regular expression literals is subject of the underlying
regular expression engine.
-- Expect stdout --
-[ "/Hello world/", "/test/gis", "/test/g", "/test1 / test2/", "/1\n\\.\u0007\bc☀\\\\/" ]
+[ "/Hello world/", "/test/gis", "/test/g", "/test1 / test2/", "/1\n\\.\u0007\\bc☀\\\\/" ]
-- End --
-- Testcase --
@@ -117,3 +117,30 @@ literal delimitters.
]);
%}
-- End --
+
+
+Testing that regex extension macros are substituted only outside of
+bracket set expressions.
+
+-- Expect stdout --
+[
+ "/ \\b \\B [\b B] /",
+ "/ \\< \\> [< >] /",
+ "/ [[:digit:]] [^[:digit:]] [d D] /",
+ "/ [[:space:]] [^[:space:]] [s S] /",
+ "/ [[:alnum:]_] [^[:alnum:]_] [w W] /"
+]
+-- End --
+
+-- Testcase --
+{%
+ printf("%.J\n", [
+ / \b \B [\b \B] /, // \b outside brackets is a word boundary,
+ // \b within brackets is backspace
+ / \< \> [\< \>] /,
+ / \d \D [\d \D] /,
+ / \s \S [\s \S] /,
+ / \w \W [\w \W] /
+ ]);
+%}
+-- End --