diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-06-21 16:26:49 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-06-21 16:26:49 -0300 |
| commit | ef28e5f789f7e7be1a3961d13cb35bbfd2542997 (patch) | |
| tree | 4f254fc849428d984de947dae1bf344be674347c /testes | |
| parent | ec65ab878e04822f1cbcc3198f19076d57900e9f (diff) | |
| download | lua-ef28e5f789f7e7be1a3961d13cb35bbfd2542997.tar.gz lua-ef28e5f789f7e7be1a3961d13cb35bbfd2542997.tar.bz2 lua-ef28e5f789f7e7be1a3961d13cb35bbfd2542997.zip | |
Removed 'int' size limit for string.rep
Diffstat (limited to 'testes')
| -rw-r--r-- | testes/strings.lua | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/testes/strings.lua b/testes/strings.lua index c124b369..a0204309 100644 --- a/testes/strings.lua +++ b/testes/strings.lua | |||
| @@ -109,10 +109,9 @@ assert(string.rep('teste', 0) == '') | |||
| 109 | assert(string.rep('tés\00tê', 2) == 'tés\0têtés\000tê') | 109 | assert(string.rep('tés\00tê', 2) == 'tés\0têtés\000tê') |
| 110 | assert(string.rep('', 10) == '') | 110 | assert(string.rep('', 10) == '') |
| 111 | 111 | ||
| 112 | if string.packsize("i") == 4 then | 112 | do |
| 113 | -- result length would be 2^31 (int overflow) | 113 | checkerror("too large", string.rep, 'aa', math.maxinteger); |
| 114 | checkerror("too large", string.rep, 'aa', (1 << 30)) | 114 | checkerror("too large", string.rep, 'a', math.maxinteger/2, ',') |
| 115 | checkerror("too large", string.rep, 'a', (1 << 30), ',') | ||
| 116 | end | 115 | end |
| 117 | 116 | ||
| 118 | -- repetitions with separator | 117 | -- repetitions with separator |
