diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2022-12-28 18:38:20 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2022-12-28 18:38:20 -0300 |
| commit | b5ab31a475ccf5f96c2ffb34fccc1d6592913794 (patch) | |
| tree | ef6d2b1844ca672dc81ab4411e37abbef2b7c48f /testes/strings.lua | |
| parent | 140cdcced5e28bde7a89e88fcae428f318565f1d (diff) | |
| parent | 314745ed8438d1276c6c928d5f9d4be018dfadb6 (diff) | |
| download | lua-b5ab31a475ccf5f96c2ffb34fccc1d6592913794.tar.gz lua-b5ab31a475ccf5f96c2ffb34fccc1d6592913794.tar.bz2 lua-b5ab31a475ccf5f96c2ffb34fccc1d6592913794.zip | |
Merge branch 'master' into nextversion
Diffstat (limited to 'testes/strings.lua')
| -rw-r--r-- | testes/strings.lua | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/testes/strings.lua b/testes/strings.lua index 337c2937..b033c6ab 100644 --- a/testes/strings.lua +++ b/testes/strings.lua | |||
| @@ -52,7 +52,7 @@ assert(("\000123456789"):sub(8) == "789") | |||
| 52 | 52 | ||
| 53 | -- testing string.find | 53 | -- testing string.find |
| 54 | assert(string.find("123456789", "345") == 3) | 54 | assert(string.find("123456789", "345") == 3) |
| 55 | a,b = string.find("123456789", "345") | 55 | local a,b = string.find("123456789", "345") |
| 56 | assert(string.sub("123456789", a, b) == "345") | 56 | assert(string.sub("123456789", a, b) == "345") |
| 57 | assert(string.find("1234567890123456789", "345", 3) == 3) | 57 | assert(string.find("1234567890123456789", "345", 3) == 3) |
| 58 | assert(string.find("1234567890123456789", "345", 4) == 13) | 58 | assert(string.find("1234567890123456789", "345", 4) == 13) |
| @@ -192,7 +192,7 @@ do -- tests for '%p' format | |||
| 192 | end | 192 | end |
| 193 | end | 193 | end |
| 194 | 194 | ||
| 195 | x = '"ílo"\n\\' | 195 | local x = '"ílo"\n\\' |
| 196 | assert(string.format('%q%s', x, x) == '"\\"ílo\\"\\\n\\\\""ílo"\n\\') | 196 | assert(string.format('%q%s', x, x) == '"\\"ílo\\"\\\n\\\\""ílo"\n\\') |
| 197 | assert(string.format('%q', "\0") == [["\0"]]) | 197 | assert(string.format('%q', "\0") == [["\0"]]) |
| 198 | assert(load(string.format('return %q', x))() == x) | 198 | assert(load(string.format('return %q', x))() == x) |
| @@ -452,7 +452,7 @@ end | |||
| 452 | do | 452 | do |
| 453 | local f = string.gmatch("1 2 3 4 5", "%d+") | 453 | local f = string.gmatch("1 2 3 4 5", "%d+") |
| 454 | assert(f() == "1") | 454 | assert(f() == "1") |
| 455 | co = coroutine.wrap(f) | 455 | local co = coroutine.wrap(f) |
| 456 | assert(co() == "2") | 456 | assert(co() == "2") |
| 457 | end | 457 | end |
| 458 | 458 | ||
