mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 13:52:28 +00:00
Upgrade Lua to 5.4.3 (#217)
Based on https://github.com/lua/lua/releases/tag/v5.4.3 (commit eadd8c7).
This commit is contained in:
parent
3ac6576fe5
commit
a73e808b25
41 changed files with 464 additions and 264 deletions
26
third_party/lua/test/api.lua
vendored
26
third_party/lua/test/api.lua
vendored
|
@ -1130,7 +1130,7 @@ do
|
|||
-- closing resources with 'closeslot'
|
||||
_ENV.xxx = true
|
||||
local a = T.testC([[
|
||||
pushvalue 2 # stack: S, NR, CH
|
||||
pushvalue 2 # stack: S, NR, CH, NR
|
||||
call 0 1 # create resource; stack: S, NR, CH, R
|
||||
toclose -1 # mark it to be closed
|
||||
pushvalue 2 # stack: S, NR, CH, R, NR
|
||||
|
@ -1151,6 +1151,30 @@ do
|
|||
]], newresource, check)
|
||||
assert(a == 3 and _ENV.xxx == nil) -- no extra items left in the stack
|
||||
|
||||
-- closing resources with 'pop'
|
||||
local a = T.testC([[
|
||||
pushvalue 2 # stack: S, NR, CH, NR
|
||||
call 0 1 # create resource; stack: S, NR, CH, R
|
||||
toclose -1 # mark it to be closed
|
||||
pushvalue 2 # stack: S, NR, CH, R, NR
|
||||
call 0 1 # create another resource; stack: S, NR, CH, R, R
|
||||
toclose -1 # mark it to be closed
|
||||
pushvalue 3 # stack: S, NR, CH, R, R, CH
|
||||
pushint 2 # there should be two open resources
|
||||
call 1 0 # stack: S, NR, CH, R, R
|
||||
pop 1 # pop second resource
|
||||
pushvalue 3 # stack: S, NR, CH, R, CH
|
||||
pushint 1 # there should be one open resource
|
||||
call 1 0 # stack: S, NR, CH, R
|
||||
pop 1 # pop other resource from the stack
|
||||
pushvalue 3 # stack: S, NR, CH, CH
|
||||
pushint 0 # there should be no open resources
|
||||
call 1 0 # stack: S, NR, CH
|
||||
pushint *
|
||||
return 1 # return stack size
|
||||
]], newresource, check)
|
||||
assert(a == 3) -- no extra items left in the stack
|
||||
|
||||
-- non-closable value
|
||||
local a, b = pcall(T.makeCfunc[[
|
||||
pushint 32
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue