summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDemi Obenour <demiobenour@gmail.com>2016-11-02 13:22:02 -0400
committerDemi Obenour <demiobenour@gmail.com>2016-11-02 13:22:02 -0400
commit14846e5e1ac11488f650afe20f333120ba23c5c5 (patch)
tree754696b1b751acdc02a2735b24039a733f7e1272 /tests
parente1038db19a6fda98a19a1df4d5f62c74c63b57d5 (diff)
Add more escaping tests
Diffstat (limited to 'tests')
-rw-r--r--tests/quotes.l24
1 files changed, 22 insertions, 2 deletions
diff --git a/tests/quotes.l b/tests/quotes.l
index 62f4fb4..d1b97eb 100644
--- a/tests/quotes.l
+++ b/tests/quotes.l
@@ -67,19 +67,39 @@ static int foo (int i){
/* indented code [[[ 3 ]]] */
/* indented code [[[[ 4 ]]]] */
/* indented code ]] unmatched [[ */
+%{
+// non-indented code [ 1 ]
+// non-indented code [[ 2 ]]
+// non-indented code [[[ 3 ]]]
+// non-indented code [[[[ 4 ]]]]
+%}
+
a /* action comment [ 1 ] */ ;
b /* action comment [[ 2 ]] */ ;
c /* action comment [[[ 3 ]]] */ ;
d /* action comment [[[[ 4 ]]]] */ ;
e /* action comment ]] unmatched [[ */ ;
f return 1+foo(a[b[c[0]]]);
-.|\n {
+.|\n {
+
+#if 0
+ action code [ 1 ] TEST_XXX
+ action code [[ 2 ]] TEST_XXX
+ action code [[[ 3 ]]] TEST_XXX
+ action code [[[[ 4 ]]]] TEST_XXX
+ action code ]] unmatched [[ TEST_XXX
+#endif
/* action block [ 1 ] TEST_XXX */
/* action block [[ 2 ]] TEST_XXX */
/* action block [[[ 3 ]]] TEST_XXX */
/* action block [[[[ 4 ]]]] TEST_XXX */
/* action block ]] unmatched [[ TEST_XXX */
- assert(!strcmp("m4_define(alpha, beta)", "m4_""define(alpha, beta)"));
+ assert(!strcmp("[[ 2 ]]", "[""[ 2 ]""]"));
+ assert(!strcmp("[[[ 3 ]]]", "[""[""[ 3 ]""]""]"));
+ assert(!strcmp("[[[[ 4 ]]]]", "[""[""[""[ 4 ]""]""]""]"));
+ assert(!strcmp("]] unmatched [[", "]""] unmatched [""["));
+ assert(!strcmp("]]m4_define(alpha, beta)[[",
+ "]""]m4_""define(alpha, beta)[""["));
return 1+foo(a[b[c[0]]]); /* TEST_XXX */
}
%%