diff options
Diffstat (limited to 'testes/api.lua')
-rw-r--r-- | testes/api.lua | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/testes/api.lua b/testes/api.lua index 752ff18f..dece98f5 100644 --- a/testes/api.lua +++ b/testes/api.lua | |||
@@ -1046,10 +1046,12 @@ assert(a == nil and c == 2) -- 2 == run-time error | |||
1046 | a, b, c = T.doremote(L1, "return a+") | 1046 | a, b, c = T.doremote(L1, "return a+") |
1047 | assert(a == nil and c == 3 and type(b) == "string") -- 3 == syntax error | 1047 | assert(a == nil and c == 3 and type(b) == "string") -- 3 == syntax error |
1048 | 1048 | ||
1049 | T.loadlib(L1) | 1049 | T.loadlib(L1, 2) -- load only 'package' |
1050 | a, b, c = T.doremote(L1, [[ | 1050 | a, b, c = T.doremote(L1, [[ |
1051 | string = require'string' | 1051 | string = require'string' |
1052 | a = require'_G'; assert(a == _G and require("_G") == a) | 1052 | local initialG = _G -- not loaded yet |
1053 | local a = require'_G'; assert(a == _G and require("_G") == a) | ||
1054 | assert(initialG == nil and io == nil) -- now we have 'assert' | ||
1053 | io = require'io'; assert(type(io.read) == "function") | 1055 | io = require'io'; assert(type(io.read) == "function") |
1054 | assert(require("io") == io) | 1056 | assert(require("io") == io) |
1055 | a = require'table'; assert(type(a.insert) == "function") | 1057 | a = require'table'; assert(type(a.insert) == "function") |
@@ -1063,7 +1065,7 @@ T.closestate(L1); | |||
1063 | 1065 | ||
1064 | 1066 | ||
1065 | L1 = T.newstate() | 1067 | L1 = T.newstate() |
1066 | T.loadlib(L1) | 1068 | T.loadlib(L1, 0) |
1067 | T.doremote(L1, "a = {}") | 1069 | T.doremote(L1, "a = {}") |
1068 | T.testC(L1, [[getglobal "a"; pushstring "x"; pushint 1; | 1070 | T.testC(L1, [[getglobal "a"; pushstring "x"; pushint 1; |
1069 | settable -3]]) | 1071 | settable -3]]) |
@@ -1446,10 +1448,10 @@ end | |||
1446 | 1448 | ||
1447 | do -- garbage collection with no extra memory | 1449 | do -- garbage collection with no extra memory |
1448 | local L = T.newstate() | 1450 | local L = T.newstate() |
1449 | T.loadlib(L) | 1451 | T.loadlib(L, 1 | 2) -- load _G and 'package' |
1450 | local res = (T.doremote(L, [[ | 1452 | local res = (T.doremote(L, [[ |
1451 | _ENV = require"_G" | 1453 | _ENV = _G |
1452 | local T = require"T" | 1454 | assert(string == nil) |
1453 | local a = {} | 1455 | local a = {} |
1454 | for i = 1, 1000 do a[i] = 'i' .. i end -- grow string table | 1456 | for i = 1, 1000 do a[i] = 'i' .. i end -- grow string table |
1455 | local stsize, stuse = T.querystr() | 1457 | local stsize, stuse = T.querystr() |