diff options
Diffstat (limited to 'testes')
-rw-r--r-- | testes/api.lua | 14 | ||||
-rw-r--r-- | testes/coroutine.lua | 2 | ||||
-rw-r--r-- | testes/nextvar.lua | 4 |
3 files changed, 11 insertions, 9 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 | |||
1039 | a, b, c = T.doremote(L1, "return a+") | 1039 | a, b, c = T.doremote(L1, "return a+") |
1040 | assert(a == nil and c == 3 and type(b) == "string") -- 3 == syntax error | 1040 | assert(a == nil and c == 3 and type(b) == "string") -- 3 == syntax error |
1041 | 1041 | ||
1042 | T.loadlib(L1) | 1042 | T.loadlib(L1, 2) -- load only 'package' |
1043 | a, b, c = T.doremote(L1, [[ | 1043 | a, 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 | ||
1058 | L1 = T.newstate() | 1060 | L1 = T.newstate() |
1059 | T.loadlib(L1) | 1061 | T.loadlib(L1, 0) |
1060 | T.doremote(L1, "a = {}") | 1062 | T.doremote(L1, "a = {}") |
1061 | T.testC(L1, [[getglobal "a"; pushstring "x"; pushint 1; | 1063 | T.testC(L1, [[getglobal "a"; pushstring "x"; pushint 1; |
1062 | settable -3]]) | 1064 | settable -3]]) |
@@ -1436,10 +1438,10 @@ end | |||
1436 | 1438 | ||
1437 | do -- garbage collection with no extra memory | 1439 | do -- 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() |
diff --git a/testes/coroutine.lua b/testes/coroutine.lua index 15fccc30..f05672a5 100644 --- a/testes/coroutine.lua +++ b/testes/coroutine.lua | |||
@@ -694,7 +694,7 @@ else | |||
694 | 694 | ||
695 | T.testC(state, "settop 0") | 695 | T.testC(state, "settop 0") |
696 | 696 | ||
697 | T.loadlib(state) | 697 | T.loadlib(state, 1 | 2) -- load _G and 'package' |
698 | 698 | ||
699 | assert(T.doremote(state, [[ | 699 | assert(T.doremote(state, [[ |
700 | coroutine = require'coroutine'; | 700 | coroutine = require'coroutine'; |
diff --git a/testes/nextvar.lua b/testes/nextvar.lua index 0874e5bb..80b3d05c 100644 --- a/testes/nextvar.lua +++ b/testes/nextvar.lua | |||
@@ -210,9 +210,9 @@ assert(T.querytab(a) == 64) -- array part has 64 elements | |||
210 | a[32] = true; a[48] = true; -- binary search will find these ones | 210 | a[32] = true; a[48] = true; -- binary search will find these ones |
211 | a[51] = true -- binary search will miss this one | 211 | a[51] = true -- binary search will miss this one |
212 | assert(#a == 48) -- this will set the limit | 212 | assert(#a == 48) -- this will set the limit |
213 | assert(select(4, T.querytab(a)) == 48) -- this is the limit now | 213 | assert(select(3, T.querytab(a)) == 48) -- this is the limit now |
214 | a[50] = true -- this will set a new limit | 214 | a[50] = true -- this will set a new limit |
215 | assert(select(4, T.querytab(a)) == 50) -- this is the limit now | 215 | assert(select(3, T.querytab(a)) == 50) -- this is the limit now |
216 | -- but the size is larger (and still inside the array part) | 216 | -- but the size is larger (and still inside the array part) |
217 | assert(#a == 51) | 217 | assert(#a == 51) |
218 | 218 | ||