aboutsummaryrefslogtreecommitdiff
path: root/testes
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-06-21 16:26:49 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-06-21 16:26:49 -0300
commitef28e5f789f7e7be1a3961d13cb35bbfd2542997 (patch)
tree4f254fc849428d984de947dae1bf344be674347c /testes
parentec65ab878e04822f1cbcc3198f19076d57900e9f (diff)
downloadlua-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.lua7
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) == '')
109assert(string.rep('tés\00tê', 2) == 'tés\0têtés\000tê') 109assert(string.rep('tés\00tê', 2) == 'tés\0têtés\000tê')
110assert(string.rep('', 10) == '') 110assert(string.rep('', 10) == '')
111 111
112if string.packsize("i") == 4 then 112do
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), ',')
116end 115end
117 116
118-- repetitions with separator 117-- repetitions with separator