From 7b42a7b13f9c6655dfa7c5951de46dcf0642b0a6 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 11 Apr 2023 10:04:59 -0300 Subject: Small extra test --- test.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'test.lua') diff --git a/test.lua b/test.lua index 4263ff4..439b6cb 100755 --- a/test.lua +++ b/test.lua @@ -1,7 +1,5 @@ #!/usr/bin/env lua --- $Id: test.lua $ - -- require"strict" -- just to be pedantic local m = require"lpeg" @@ -1394,6 +1392,12 @@ e = compile([[ e = compile("{[0-9]+'.'?[0-9]*} -> sin", math) assert(e:match("2.34") == math.sin(2.34)) +e = compile("'pi' -> math", _G) +assert(e:match("pi") == math.pi) + +e = compile("[ ]* 'version' -> _VERSION", _G) +assert(e:match(" version") == _VERSION) + function eq (_, _, a, b) return a == b end -- cgit v1.2.3-55-g6feb