aboutsummaryrefslogtreecommitdiff
path: root/testes
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-07-19 17:34:22 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-07-19 17:34:22 -0300
commitf407b3c4a1bc9667867ec51e835c20d97aab55a2 (patch)
treead629983fbde70d5446411d765a99a1b724eb82b /testes
parenta546138d158d79d44b2c5b42630be00d306f4e7c (diff)
downloadlua-f407b3c4a1bc9667867ec51e835c20d97aab55a2.tar.gz
lua-f407b3c4a1bc9667867ec51e835c20d97aab55a2.tar.bz2
lua-f407b3c4a1bc9667867ec51e835c20d97aab55a2.zip
Using CIST_CLSRET instead of trick with 'nresults'
The callstatus flag CIST_CLSRET is used in all tests for the presence of variables to be closed in C functions.
Diffstat (limited to 'testes')
-rw-r--r--testes/api.lua17
1 files changed, 17 insertions, 0 deletions
diff --git a/testes/api.lua b/testes/api.lua
index dc485240..ae2f82dd 100644
--- a/testes/api.lua
+++ b/testes/api.lua
@@ -165,6 +165,23 @@ do -- test returning more results than fit in the caller stack
165end 165end
166 166
167 167
168do -- testing multipe returns
169 local function foo (n)
170 if n > 0 then return n, foo(n - 1) end
171 end
172
173 local t = {T.testC("call 1 10; return 10", foo, 20)}
174 assert(t[1] == 20 and t[10] == 11 and t[11] == nil)
175
176 local t = table.pack(T.testC("call 1 10; return 10", foo, 2))
177 assert(t[1] == 2 and t[2] == 1 and t[3] == nil and t.n == 10)
178
179 local t = {T.testC([[
180 checkstack 300 "error"; call 1 250; return 250]], foo, 250)}
181 assert(t[1] == 250 and t[250] == 1 and t[251] == nil)
182end
183
184
168-- testing globals 185-- testing globals
169_G.AA = 14; _G.BB = "a31" 186_G.AA = 14; _G.BB = "a31"
170local a = {T.testC[[ 187local a = {T.testC[[