aboutsummaryrefslogtreecommitdiff
path: root/testes
diff options
context:
space:
mode:
Diffstat (limited to 'testes')
-rw-r--r--testes/api.lua18
1 files changed, 10 insertions, 8 deletions
diff --git a/testes/api.lua b/testes/api.lua
index a6ddca8e..ed857fd0 100644
--- a/testes/api.lua
+++ b/testes/api.lua
@@ -985,18 +985,20 @@ do
985 return x 985 return x
986 end 986 end
987 987
988 local a = T.testC([[ 988 local a, b = T.testC([[
989 call 0 1 # create resource 989 call 0 1 # create resource
990 toclose # mark it to be closed 990 pushint 34
991 return 1 991 toclose -2 # mark call result to be closed
992 toclose -1 # mark number to be closed (will be ignored)
993 return 2
992 ]], newresource) 994 ]], newresource)
993 assert(a[1] == 11) 995 assert(a[1] == 11 and b == 34)
994 assert(#openresource == 0) -- was closed 996 assert(#openresource == 0) -- was closed
995 997
996 -- repeat the test, but calling function in a 'multret' context 998 -- repeat the test, but calling function in a 'multret' context
997 local a = {T.testC([[ 999 local a = {T.testC([[
998 call 0 1 # create resource 1000 call 0 1 # create resource
999 toclose # mark it to be closed 1001 toclose 2 # mark it to be closed
1000 return 2 1002 return 2
1001 ]], newresource)} 1003 ]], newresource)}
1002 assert(type(a[1]) == "string" and a[2][1] == 11) 1004 assert(type(a[1]) == "string" and a[2][1] == 11)
@@ -1005,7 +1007,7 @@ do
1005 -- error 1007 -- error
1006 local a, b = pcall(T.testC, [[ 1008 local a, b = pcall(T.testC, [[
1007 call 0 1 # create resource 1009 call 0 1 # create resource
1008 toclose # mark it to be closed 1010 toclose -1 # mark it to be closed
1009 error # resource is the error object 1011 error # resource is the error object
1010 ]], newresource) 1012 ]], newresource)
1011 assert(a == false and b[1] == 11) 1013 assert(a == false and b[1] == 11)
@@ -1019,10 +1021,10 @@ do
1019 local a = T.testC([[ 1021 local a = T.testC([[
1020 pushvalue 2 1022 pushvalue 2
1021 call 0 1 # create resource 1023 call 0 1 # create resource
1022 toclose # mark it to be closed 1024 toclose -1 # mark it to be closed
1023 pushvalue 2 1025 pushvalue 2
1024 call 0 1 # create another resource 1026 call 0 1 # create another resource
1025 toclose # mark it to be closed 1027 toclose -1 # mark it to be closed
1026 pushvalue 3 1028 pushvalue 3
1027 pushint 2 # there should be two open resources 1029 pushint 2 # there should be two open resources
1028 call 1 0 1030 call 1 0