aboutsummaryrefslogtreecommitdiff
path: root/testes/api.lua
diff options
context:
space:
mode:
Diffstat (limited to 'testes/api.lua')
-rw-r--r--testes/api.lua14
1 files changed, 8 insertions, 6 deletions
diff --git a/testes/api.lua b/testes/api.lua
index bd85a923..f8e36ae3 100644
--- a/testes/api.lua
+++ b/testes/api.lua
@@ -1039,10 +1039,12 @@ assert(a == nil and b == 2) -- 2 == run-time error
1039a, b, c = T.doremote(L1, "return a+") 1039a, b, c = T.doremote(L1, "return a+")
1040assert(a == nil and c == 3 and type(b) == "string") -- 3 == syntax error 1040assert(a == nil and c == 3 and type(b) == "string") -- 3 == syntax error
1041 1041
1042T.loadlib(L1) 1042T.loadlib(L1, 2) -- load only 'package'
1043a, b, c = T.doremote(L1, [[ 1043a, b, c = T.doremote(L1, [[
1044 string = require'string' 1044 string = require'string'
1045 a = require'_G'; assert(a == _G and require("_G") == a) 1045 local initialG = _G -- not loaded yet
1046 local a = require'_G'; assert(a == _G and require("_G") == a)
1047 assert(initialG == nil and io == nil) -- now we have 'assert'
1046 io = require'io'; assert(type(io.read) == "function") 1048 io = require'io'; assert(type(io.read) == "function")
1047 assert(require("io") == io) 1049 assert(require("io") == io)
1048 a = require'table'; assert(type(a.insert) == "function") 1050 a = require'table'; assert(type(a.insert) == "function")
@@ -1056,7 +1058,7 @@ T.closestate(L1);
1056 1058
1057 1059
1058L1 = T.newstate() 1060L1 = T.newstate()
1059T.loadlib(L1) 1061T.loadlib(L1, 0)
1060T.doremote(L1, "a = {}") 1062T.doremote(L1, "a = {}")
1061T.testC(L1, [[getglobal "a"; pushstring "x"; pushint 1; 1063T.testC(L1, [[getglobal "a"; pushstring "x"; pushint 1;
1062 settable -3]]) 1064 settable -3]])
@@ -1436,10 +1438,10 @@ end
1436 1438
1437do -- garbage collection with no extra memory 1439do -- garbage collection with no extra memory
1438 local L = T.newstate() 1440 local L = T.newstate()
1439 T.loadlib(L) 1441 T.loadlib(L, 1 | 2) -- load _G and 'package'
1440 local res = (T.doremote(L, [[ 1442 local res = (T.doremote(L, [[
1441 _ENV = require"_G" 1443 _ENV = _G
1442 local T = require"T" 1444 assert(string == nil)
1443 local a = {} 1445 local a = {}
1444 for i = 1, 1000 do a[i] = 'i' .. i end -- grow string table 1446 for i = 1, 1000 do a[i] = 'i' .. i end -- grow string table
1445 local stsize, stuse = T.querystr() 1447 local stsize, stuse = T.querystr()