aboutsummaryrefslogtreecommitdiff
path: root/testes
diff options
context:
space:
mode:
authorRoberto I <roberto@inf.puc-rio.br>2025-11-24 11:39:46 -0300
committerRoberto I <roberto@inf.puc-rio.br>2025-11-24 11:39:46 -0300
commitd94f7ba3040eb06895d7305014e88157d3bfd1a1 (patch)
tree5e9b7b7cd06dca3c0902a1c9d4e70eaddde9ebab /testes
parent4cf498210e6a60637a7abb06d32460ec21efdbdc (diff)
downloadlua-d94f7ba3040eb06895d7305014e88157d3bfd1a1.tar.gz
lua-d94f7ba3040eb06895d7305014e88157d3bfd1a1.tar.bz2
lua-d94f7ba3040eb06895d7305014e88157d3bfd1a1.zip
Details
Comments, capitalization in the manual, globals in test 'heady.lua'
Diffstat (limited to 'testes')
-rw-r--r--testes/heavy.lua18
1 files changed, 10 insertions, 8 deletions
diff --git a/testes/heavy.lua b/testes/heavy.lua
index 3b4e4ce3..e7219a91 100644
--- a/testes/heavy.lua
+++ b/testes/heavy.lua
@@ -1,6 +1,8 @@
1-- $Id: testes/heavy.lua,v $ 1-- $Id: testes/heavy.lua,v $
2-- See Copyright Notice in file lua.h 2-- See Copyright Notice in file lua.h
3 3
4global <const> *
5
4local function teststring () 6local function teststring ()
5 print("creating a string too long") 7 print("creating a string too long")
6 do 8 do
@@ -47,9 +49,9 @@ local function loadrep (x, what)
47end 49end
48 50
49 51
50function controlstruct () 52local function controlstruct ()
51 print("control structure too long") 53 print("control structure too long")
52 local lim = ((1 << 24) - 2) // 3 54 local lim = ((1 << 24) - 2) // 4
53 local s = string.rep("a = a + 1\n", lim) 55 local s = string.rep("a = a + 1\n", lim)
54 s = "while true do " .. s .. "end" 56 s = "while true do " .. s .. "end"
55 assert(load(s)) 57 assert(load(s))
@@ -63,7 +65,7 @@ function controlstruct ()
63end 65end
64 66
65 67
66function manylines () 68local function manylines ()
67 print("loading chunk with too many lines") 69 print("loading chunk with too many lines")
68 local st, msg = loadrep("\n", "lines") 70 local st, msg = loadrep("\n", "lines")
69 assert(not st and string.find(msg, "too many lines")) 71 assert(not st and string.find(msg, "too many lines"))
@@ -71,7 +73,7 @@ function manylines ()
71end 73end
72 74
73 75
74function hugeid () 76local function hugeid ()
75 print("loading chunk with huge identifier") 77 print("loading chunk with huge identifier")
76 local st, msg = loadrep("a", "chars") 78 local st, msg = loadrep("a", "chars")
77 assert(not st and 79 assert(not st and
@@ -80,7 +82,7 @@ function hugeid ()
80 print('+') 82 print('+')
81end 83end
82 84
83function toomanyinst () 85local function toomanyinst ()
84 print("loading chunk with too many instructions") 86 print("loading chunk with too many instructions")
85 local st, msg = loadrep("a = 10; ", "instructions") 87 local st, msg = loadrep("a = 10; ", "instructions")
86 print('+') 88 print('+')
@@ -107,7 +109,7 @@ local function loadrepfunc (prefix, f)
107end 109end
108 110
109 111
110function toomanyconst () 112local function toomanyconst ()
111 print("loading function with too many constants") 113 print("loading function with too many constants")
112 loadrepfunc("function foo () return {0,", 114 loadrepfunc("function foo () return {0,",
113 function (n) 115 function (n)
@@ -126,7 +128,7 @@ function toomanyconst ()
126end 128end
127 129
128 130
129function toomanystr () 131local function toomanystr ()
130 local a = {} 132 local a = {}
131 local st, msg = pcall(function () 133 local st, msg = pcall(function ()
132 for i = 1, math.huge do 134 for i = 1, math.huge do
@@ -144,7 +146,7 @@ function toomanystr ()
144end 146end
145 147
146 148
147function toomanyidx () 149local function toomanyidx ()
148 local a = {} 150 local a = {}
149 local st, msg = pcall(function () 151 local st, msg = pcall(function ()
150 for i = 1, math.huge do 152 for i = 1, math.huge do