aboutsummaryrefslogtreecommitdiff
path: root/test.lua
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2023-04-11 10:04:59 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2023-04-11 10:04:59 -0300
commit7b42a7b13f9c6655dfa7c5951de46dcf0642b0a6 (patch)
tree82c9ea6b32ccf86d5bb4c2818616ad519bf3cfc2 /test.lua
parent05edfcff9b7eca52571b221e614b5cbf84e7d43d (diff)
downloadlpeg-7b42a7b13f9c6655dfa7c5951de46dcf0642b0a6.tar.gz
lpeg-7b42a7b13f9c6655dfa7c5951de46dcf0642b0a6.tar.bz2
lpeg-7b42a7b13f9c6655dfa7c5951de46dcf0642b0a6.zip
Small extra test
Diffstat (limited to 'test.lua')
-rwxr-xr-xtest.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/test.lua b/test.lua
index 4263ff4..439b6cb 100755
--- a/test.lua
+++ b/test.lua
@@ -1,7 +1,5 @@
1#!/usr/bin/env lua 1#!/usr/bin/env lua
2 2
3-- $Id: test.lua $
4
5-- require"strict" -- just to be pedantic 3-- require"strict" -- just to be pedantic
6 4
7local m = require"lpeg" 5local m = require"lpeg"
@@ -1394,6 +1392,12 @@ e = compile([[
1394e = compile("{[0-9]+'.'?[0-9]*} -> sin", math) 1392e = compile("{[0-9]+'.'?[0-9]*} -> sin", math)
1395assert(e:match("2.34") == math.sin(2.34)) 1393assert(e:match("2.34") == math.sin(2.34))
1396 1394
1395e = compile("'pi' -> math", _G)
1396assert(e:match("pi") == math.pi)
1397
1398e = compile("[ ]* 'version' -> _VERSION", _G)
1399assert(e:match(" version") == _VERSION)
1400
1397 1401
1398function eq (_, _, a, b) return a == b end 1402function eq (_, _, a, b) return a == b end
1399 1403