diff options
| author | Roberto I <roberto@inf.puc-rio.br> | 2025-11-24 11:39:46 -0300 |
|---|---|---|
| committer | Roberto I <roberto@inf.puc-rio.br> | 2025-11-24 11:39:46 -0300 |
| commit | d94f7ba3040eb06895d7305014e88157d3bfd1a1 (patch) | |
| tree | 5e9b7b7cd06dca3c0902a1c9d4e70eaddde9ebab /testes | |
| parent | 4cf498210e6a60637a7abb06d32460ec21efdbdc (diff) | |
| download | lua-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.lua | 18 |
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 | ||
| 4 | global <const> * | ||
| 5 | |||
| 4 | local function teststring () | 6 | local 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) | |||
| 47 | end | 49 | end |
| 48 | 50 | ||
| 49 | 51 | ||
| 50 | function controlstruct () | 52 | local 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 () | |||
| 63 | end | 65 | end |
| 64 | 66 | ||
| 65 | 67 | ||
| 66 | function manylines () | 68 | local 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 () | |||
| 71 | end | 73 | end |
| 72 | 74 | ||
| 73 | 75 | ||
| 74 | function hugeid () | 76 | local 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('+') |
| 81 | end | 83 | end |
| 82 | 84 | ||
| 83 | function toomanyinst () | 85 | local 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) | |||
| 107 | end | 109 | end |
| 108 | 110 | ||
| 109 | 111 | ||
| 110 | function toomanyconst () | 112 | local 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 () | |||
| 126 | end | 128 | end |
| 127 | 129 | ||
| 128 | 130 | ||
| 129 | function toomanystr () | 131 | local 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 () | |||
| 144 | end | 146 | end |
| 145 | 147 | ||
| 146 | 148 | ||
| 147 | function toomanyidx () | 149 | local 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 |
