diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-04-11 10:04:59 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-04-11 10:04:59 -0300 |
commit | 7b42a7b13f9c6655dfa7c5951de46dcf0642b0a6 (patch) | |
tree | 82c9ea6b32ccf86d5bb4c2818616ad519bf3cfc2 | |
parent | 05edfcff9b7eca52571b221e614b5cbf84e7d43d (diff) | |
download | lpeg-7b42a7b13f9c6655dfa7c5951de46dcf0642b0a6.tar.gz lpeg-7b42a7b13f9c6655dfa7c5951de46dcf0642b0a6.tar.bz2 lpeg-7b42a7b13f9c6655dfa7c5951de46dcf0642b0a6.zip |
Small extra test
-rwxr-xr-x | test.lua | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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 | ||
7 | local m = require"lpeg" | 5 | local m = require"lpeg" |
@@ -1394,6 +1392,12 @@ e = compile([[ | |||
1394 | e = compile("{[0-9]+'.'?[0-9]*} -> sin", math) | 1392 | e = compile("{[0-9]+'.'?[0-9]*} -> sin", math) |
1395 | assert(e:match("2.34") == math.sin(2.34)) | 1393 | assert(e:match("2.34") == math.sin(2.34)) |
1396 | 1394 | ||
1395 | e = compile("'pi' -> math", _G) | ||
1396 | assert(e:match("pi") == math.pi) | ||
1397 | |||
1398 | e = compile("[ ]* 'version' -> _VERSION", _G) | ||
1399 | assert(e:match(" version") == _VERSION) | ||
1400 | |||
1397 | 1401 | ||
1398 | function eq (_, _, a, b) return a == b end | 1402 | function eq (_, _, a, b) return a == b end |
1399 | 1403 | ||