aboutsummaryrefslogtreecommitdiff
path: root/test.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test.lua')
-rwxr-xr-xtest.lua11
1 files changed, 11 insertions, 0 deletions
diff --git a/test.lua b/test.lua
index 403aa09..4263ff4 100755
--- a/test.lua
+++ b/test.lua
@@ -1032,6 +1032,17 @@ local function id (s, i, ...)
1032 return true, ... 1032 return true, ...
1033end 1033end
1034 1034
1035do -- run-time capture in an end predicate (should discard its value)
1036 local x = 0
1037 function foo (s, i)
1038 x = x + 1
1039 return true, x
1040 end
1041
1042 local p = #(m.Cmt("", foo) * "xx") * m.Cmt("", foo)
1043 assert(p:match("xx") == 2)
1044end
1045
1035assert(m.Cmt(m.Cs((m.Cmt(m.S'abc' / { a = 'x', c = 'y' }, id) + 1046assert(m.Cmt(m.Cs((m.Cmt(m.S'abc' / { a = 'x', c = 'y' }, id) +
1036 m.R'09'^1 / string.char + 1047 m.R'09'^1 / string.char +
1037 m.P(1))^0), id):match"acb98+68c" == "xyb\98+\68y") 1048 m.P(1))^0), id):match"acb98+68c" == "xyb\98+\68y")