diff options
Diffstat (limited to '')
-rw-r--r-- | testes/pm.lua | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/testes/pm.lua b/testes/pm.lua index 2a0cfb0b..720d2a35 100644 --- a/testes/pm.lua +++ b/testes/pm.lua | |||
@@ -6,6 +6,8 @@ | |||
6 | 6 | ||
7 | print('testing pattern matching') | 7 | print('testing pattern matching') |
8 | 8 | ||
9 | global <const> * | ||
10 | |||
9 | local function checkerror (msg, f, ...) | 11 | local function checkerror (msg, f, ...) |
10 | local s, err = pcall(f, ...) | 12 | local s, err = pcall(f, ...) |
11 | assert(not s and string.find(err, msg)) | 13 | assert(not s and string.find(err, msg)) |
@@ -23,9 +25,9 @@ a,b = string.find('alo', '') | |||
23 | assert(a == 1 and b == 0) | 25 | assert(a == 1 and b == 0) |
24 | a,b = string.find('a\0o a\0o a\0o', 'a', 1) -- first position | 26 | a,b = string.find('a\0o a\0o a\0o', 'a', 1) -- first position |
25 | assert(a == 1 and b == 1) | 27 | assert(a == 1 and b == 1) |
26 | a,b = string.find('a\0o a\0o a\0o', 'a\0o', 2) -- starts in the midle | 28 | a,b = string.find('a\0o a\0o a\0o', 'a\0o', 2) -- starts in the middle |
27 | assert(a == 5 and b == 7) | 29 | assert(a == 5 and b == 7) |
28 | a,b = string.find('a\0o a\0o a\0o', 'a\0o', 9) -- starts in the midle | 30 | a,b = string.find('a\0o a\0o a\0o', 'a\0o', 9) -- starts in the middle |
29 | assert(a == 9 and b == 11) | 31 | assert(a == 9 and b == 11) |
30 | a,b = string.find('a\0a\0a\0a\0\0ab', '\0ab', 2); -- finds at the end | 32 | a,b = string.find('a\0a\0a\0a\0\0ab', '\0ab', 2); -- finds at the end |
31 | assert(a == 9 and b == 11); | 33 | assert(a == 9 and b == 11); |