diff options
Diffstat (limited to 'testes/api.lua')
| -rw-r--r-- | testes/api.lua | 112 |
1 files changed, 61 insertions, 51 deletions
diff --git a/testes/api.lua b/testes/api.lua index f8e36ae3..dece98f5 100644 --- a/testes/api.lua +++ b/testes/api.lua | |||
| @@ -14,7 +14,7 @@ local pack = table.pack | |||
| 14 | -- standard error message for memory errors | 14 | -- standard error message for memory errors |
| 15 | local MEMERRMSG = "not enough memory" | 15 | local MEMERRMSG = "not enough memory" |
| 16 | 16 | ||
| 17 | function tcheck (t1, t2) | 17 | local function tcheck (t1, t2) |
| 18 | assert(t1.n == (t2.n or #t2) + 1) | 18 | assert(t1.n == (t2.n or #t2) + 1) |
| 19 | for i = 2, t1.n do assert(t1[i] == t2[i - 1]) end | 19 | for i = 2, t1.n do assert(t1[i] == t2[i - 1]) end |
| 20 | end | 20 | end |
| @@ -28,7 +28,7 @@ end | |||
| 28 | 28 | ||
| 29 | print('testing C API') | 29 | print('testing C API') |
| 30 | 30 | ||
| 31 | a = T.testC("pushvalue R; return 1") | 31 | local a = T.testC("pushvalue R; return 1") |
| 32 | assert(a == debug.getregistry()) | 32 | assert(a == debug.getregistry()) |
| 33 | 33 | ||
| 34 | 34 | ||
| @@ -43,10 +43,10 @@ a = T.d2s(12458954321123.0) | |||
| 43 | assert(a == string.pack("d", 12458954321123.0)) | 43 | assert(a == string.pack("d", 12458954321123.0)) |
| 44 | assert(T.s2d(a) == 12458954321123.0) | 44 | assert(T.s2d(a) == 12458954321123.0) |
| 45 | 45 | ||
| 46 | a,b,c = T.testC("pushnum 1; pushnum 2; pushnum 3; return 2") | 46 | local a,b,c = T.testC("pushnum 1; pushnum 2; pushnum 3; return 2") |
| 47 | assert(a == 2 and b == 3 and not c) | 47 | assert(a == 2 and b == 3 and not c) |
| 48 | 48 | ||
| 49 | f = T.makeCfunc("pushnum 1; pushnum 2; pushnum 3; return 2") | 49 | local f = T.makeCfunc("pushnum 1; pushnum 2; pushnum 3; return 2") |
| 50 | a,b,c = f() | 50 | a,b,c = f() |
| 51 | assert(a == 2 and b == 3 and not c) | 51 | assert(a == 2 and b == 3 and not c) |
| 52 | 52 | ||
| @@ -61,7 +61,7 @@ assert(a==false and b==true and c==false) | |||
| 61 | a,b,c = T.testC("gettop; return 2", 10, 20, 30, 40) | 61 | a,b,c = T.testC("gettop; return 2", 10, 20, 30, 40) |
| 62 | assert(a == 40 and b == 5 and not c) | 62 | assert(a == 40 and b == 5 and not c) |
| 63 | 63 | ||
| 64 | t = pack(T.testC("settop 5; return *", 2, 3)) | 64 | local t = pack(T.testC("settop 5; return *", 2, 3)) |
| 65 | tcheck(t, {n=4,2,3}) | 65 | tcheck(t, {n=4,2,3}) |
| 66 | 66 | ||
| 67 | t = pack(T.testC("settop 0; settop 15; return 10", 3, 1, 23)) | 67 | t = pack(T.testC("settop 0; settop 15; return 10", 3, 1, 23)) |
| @@ -166,16 +166,17 @@ end | |||
| 166 | 166 | ||
| 167 | 167 | ||
| 168 | -- testing globals | 168 | -- testing globals |
| 169 | _G.a = 14; _G.b = "a31" | 169 | _G.AA = 14; _G.BB = "a31" |
| 170 | local a = {T.testC[[ | 170 | local a = {T.testC[[ |
| 171 | getglobal a; | 171 | getglobal AA; |
| 172 | getglobal b; | 172 | getglobal BB; |
| 173 | getglobal b; | 173 | getglobal BB; |
| 174 | setglobal a; | 174 | setglobal AA; |
| 175 | return * | 175 | return * |
| 176 | ]]} | 176 | ]]} |
| 177 | assert(a[2] == 14 and a[3] == "a31" and a[4] == nil and _G.a == "a31") | 177 | assert(a[2] == 14 and a[3] == "a31" and a[4] == nil and _G.AA == "a31") |
| 178 | 178 | ||
| 179 | _G.AA, _G.BB = nil | ||
| 179 | 180 | ||
| 180 | -- testing arith | 181 | -- testing arith |
| 181 | assert(T.testC("pushnum 10; pushnum 20; arith /; return 1") == 0.5) | 182 | assert(T.testC("pushnum 10; pushnum 20; arith /; return 1") == 0.5) |
| @@ -199,13 +200,14 @@ a,b,c = T.testC([[pushnum 1; | |||
| 199 | pushstring 10; arith _; | 200 | pushstring 10; arith _; |
| 200 | pushstring 5; return 3]]) | 201 | pushstring 5; return 3]]) |
| 201 | assert(a == 1 and b == -10 and c == "5") | 202 | assert(a == 1 and b == -10 and c == "5") |
| 202 | mt = {__add = function (a,b) return setmetatable({a[1] + b[1]}, mt) end, | 203 | local mt = { |
| 204 | __add = function (a,b) return setmetatable({a[1] + b[1]}, mt) end, | ||
| 203 | __mod = function (a,b) return setmetatable({a[1] % b[1]}, mt) end, | 205 | __mod = function (a,b) return setmetatable({a[1] % b[1]}, mt) end, |
| 204 | __unm = function (a) return setmetatable({a[1]* 2}, mt) end} | 206 | __unm = function (a) return setmetatable({a[1]* 2}, mt) end} |
| 205 | a,b,c = setmetatable({4}, mt), | 207 | a,b,c = setmetatable({4}, mt), |
| 206 | setmetatable({8}, mt), | 208 | setmetatable({8}, mt), |
| 207 | setmetatable({-3}, mt) | 209 | setmetatable({-3}, mt) |
| 208 | x,y,z = T.testC("arith +; return 2", 10, a, b) | 210 | local x,y,z = T.testC("arith +; return 2", 10, a, b) |
| 209 | assert(x == 10 and y[1] == 12 and z == nil) | 211 | assert(x == 10 and y[1] == 12 and z == nil) |
| 210 | assert(T.testC("arith %; return 1", a, c)[1] == 4%-3) | 212 | assert(T.testC("arith %; return 1", a, c)[1] == 4%-3) |
| 211 | assert(T.testC("arith _; arith +; arith %; return 1", b, a, c)[1] == | 213 | assert(T.testC("arith _; arith +; arith %; return 1", b, a, c)[1] == |
| @@ -312,9 +314,9 @@ assert(T.testC("concat 1; return 1", "xuxu") == "xuxu") | |||
| 312 | 314 | ||
| 313 | -- testing lua_is | 315 | -- testing lua_is |
| 314 | 316 | ||
| 315 | function B(x) return x and 1 or 0 end | 317 | local function B (x) return x and 1 or 0 end |
| 316 | 318 | ||
| 317 | function count (x, n) | 319 | local function count (x, n) |
| 318 | n = n or 2 | 320 | n = n or 2 |
| 319 | local prog = [[ | 321 | local prog = [[ |
| 320 | isnumber %d; | 322 | isnumber %d; |
| @@ -345,7 +347,7 @@ assert(count(nil, 15) == 100) | |||
| 345 | 347 | ||
| 346 | -- testing lua_to... | 348 | -- testing lua_to... |
| 347 | 349 | ||
| 348 | function to (s, x, n) | 350 | local function to (s, x, n) |
| 349 | n = n or 2 | 351 | n = n or 2 |
| 350 | return T.testC(string.format("%s %d; return 1", s, n), x) | 352 | return T.testC(string.format("%s %d; return 1", s, n), x) |
| 351 | end | 353 | end |
| @@ -486,11 +488,12 @@ a = T.testC([[ | |||
| 486 | pushvalue 3; insert -2; pcall 1 1 0; | 488 | pushvalue 3; insert -2; pcall 1 1 0; |
| 487 | pcall 0 0 0; | 489 | pcall 0 0 0; |
| 488 | return 1 | 490 | return 1 |
| 489 | ]], "x=150", function (a) assert(a==nil); return 3 end) | 491 | ]], "XX=150", function (a) assert(a==nil); return 3 end) |
| 490 | 492 | ||
| 491 | assert(type(a) == 'string' and x == 150) | 493 | assert(type(a) == 'string' and XX == 150) |
| 494 | _G.XX = nil | ||
| 492 | 495 | ||
| 493 | function check3(p, ...) | 496 | local function check3(p, ...) |
| 494 | local arg = {...} | 497 | local arg = {...} |
| 495 | assert(#arg == 3) | 498 | assert(#arg == 3) |
| 496 | assert(string.find(arg[3], p)) | 499 | assert(string.find(arg[3], p)) |
| @@ -500,7 +503,7 @@ check3("%.", T.testC("loadfile 2; return *", ".")) | |||
| 500 | check3("xxxx", T.testC("loadfile 2; return *", "xxxx")) | 503 | check3("xxxx", T.testC("loadfile 2; return *", "xxxx")) |
| 501 | 504 | ||
| 502 | -- test errors in non protected threads | 505 | -- test errors in non protected threads |
| 503 | function checkerrnopro (code, msg) | 506 | local function checkerrnopro (code, msg) |
| 504 | local th = coroutine.create(function () end) -- create new thread | 507 | local th = coroutine.create(function () end) -- create new thread |
| 505 | local stt, err = pcall(T.testC, th, code) -- run code there | 508 | local stt, err = pcall(T.testC, th, code) -- run code there |
| 506 | assert(not stt and string.find(err, msg)) | 509 | assert(not stt and string.find(err, msg)) |
| @@ -510,8 +513,9 @@ if not _soft then | |||
| 510 | collectgarbage("stop") -- avoid __gc with full stack | 513 | collectgarbage("stop") -- avoid __gc with full stack |
| 511 | checkerrnopro("pushnum 3; call 0 0", "attempt to call") | 514 | checkerrnopro("pushnum 3; call 0 0", "attempt to call") |
| 512 | print"testing stack overflow in unprotected thread" | 515 | print"testing stack overflow in unprotected thread" |
| 513 | function f () f() end | 516 | function F () F() end |
| 514 | checkerrnopro("getglobal 'f'; call 0 0;", "stack overflow") | 517 | checkerrnopro("getglobal 'F'; call 0 0;", "stack overflow") |
| 518 | F = nil | ||
| 515 | collectgarbage("restart") | 519 | collectgarbage("restart") |
| 516 | end | 520 | end |
| 517 | print"+" | 521 | print"+" |
| @@ -588,7 +592,7 @@ assert(a[a] == "x") | |||
| 588 | 592 | ||
| 589 | b = setmetatable({p = a}, {}) | 593 | b = setmetatable({p = a}, {}) |
| 590 | getmetatable(b).__index = function (t, i) return t.p[i] end | 594 | getmetatable(b).__index = function (t, i) return t.p[i] end |
| 591 | k, x = T.testC("gettable 3, return 2", 4, b, 20, 35, "x") | 595 | local k, x = T.testC("gettable 3, return 2", 4, b, 20, 35, "x") |
| 592 | assert(x == 15 and k == 35) | 596 | assert(x == 15 and k == 35) |
| 593 | k = T.testC("getfield 2 y, return 1", b) | 597 | k = T.testC("getfield 2 y, return 1", b) |
| 594 | assert(k == 12) | 598 | assert(k == 12) |
| @@ -748,8 +752,8 @@ local i = T.ref{} | |||
| 748 | T.unref(i) | 752 | T.unref(i) |
| 749 | assert(T.ref{} == i) | 753 | assert(T.ref{} == i) |
| 750 | 754 | ||
| 751 | Arr = {} | 755 | local Arr = {} |
| 752 | Lim = 100 | 756 | local Lim = 100 |
| 753 | for i=1,Lim do -- lock many objects | 757 | for i=1,Lim do -- lock many objects |
| 754 | Arr[i] = T.ref({}) | 758 | Arr[i] = T.ref({}) |
| 755 | end | 759 | end |
| @@ -761,7 +765,7 @@ for i=1,Lim do -- unlock all them | |||
| 761 | T.unref(Arr[i]) | 765 | T.unref(Arr[i]) |
| 762 | end | 766 | end |
| 763 | 767 | ||
| 764 | function printlocks () | 768 | local function printlocks () |
| 765 | local f = T.makeCfunc("gettable R; return 1") | 769 | local f = T.makeCfunc("gettable R; return 1") |
| 766 | local n = f("n") | 770 | local n = f("n") |
| 767 | print("n", n) | 771 | print("n", n) |
| @@ -793,8 +797,8 @@ assert(type(T.getref(a)) == 'table') | |||
| 793 | 797 | ||
| 794 | 798 | ||
| 795 | -- colect in cl the `val' of all collected userdata | 799 | -- colect in cl the `val' of all collected userdata |
| 796 | tt = {} | 800 | local tt = {} |
| 797 | cl = {n=0} | 801 | local cl = {n=0} |
| 798 | A = nil; B = nil | 802 | A = nil; B = nil |
| 799 | local F | 803 | local F |
| 800 | F = function (x) | 804 | F = function (x) |
| @@ -817,6 +821,7 @@ F = function (x) | |||
| 817 | end | 821 | end |
| 818 | tt.__gc = F | 822 | tt.__gc = F |
| 819 | 823 | ||
| 824 | |||
| 820 | -- test whether udate collection frees memory in the right time | 825 | -- test whether udate collection frees memory in the right time |
| 821 | do | 826 | do |
| 822 | collectgarbage(); | 827 | collectgarbage(); |
| @@ -853,9 +858,9 @@ end | |||
| 853 | collectgarbage("stop") | 858 | collectgarbage("stop") |
| 854 | 859 | ||
| 855 | -- create 3 userdatas with tag `tt' | 860 | -- create 3 userdatas with tag `tt' |
| 856 | a = T.newuserdata(0); debug.setmetatable(a, tt); na = T.udataval(a) | 861 | a = T.newuserdata(0); debug.setmetatable(a, tt); local na = T.udataval(a) |
| 857 | b = T.newuserdata(0); debug.setmetatable(b, tt); nb = T.udataval(b) | 862 | b = T.newuserdata(0); debug.setmetatable(b, tt); local nb = T.udataval(b) |
| 858 | c = T.newuserdata(0); debug.setmetatable(c, tt); nc = T.udataval(c) | 863 | c = T.newuserdata(0); debug.setmetatable(c, tt); local nc = T.udataval(c) |
| 859 | 864 | ||
| 860 | -- create userdata without meta table | 865 | -- create userdata without meta table |
| 861 | x = T.newuserdata(4) | 866 | x = T.newuserdata(4) |
| @@ -866,9 +871,9 @@ checkerr("FILE%* expected, got userdata", io.input, x) | |||
| 866 | 871 | ||
| 867 | assert(debug.getmetatable(x) == nil and debug.getmetatable(y) == nil) | 872 | assert(debug.getmetatable(x) == nil and debug.getmetatable(y) == nil) |
| 868 | 873 | ||
| 869 | d=T.ref(a); | 874 | local d = T.ref(a); |
| 870 | e=T.ref(b); | 875 | local e = T.ref(b); |
| 871 | f=T.ref(c); | 876 | local f = T.ref(c); |
| 872 | t = {T.getref(d), T.getref(e), T.getref(f)} | 877 | t = {T.getref(d), T.getref(e), T.getref(f)} |
| 873 | assert(t[1] == a and t[2] == b and t[3] == c) | 878 | assert(t[1] == a and t[2] == b and t[3] == c) |
| 874 | 879 | ||
| @@ -888,7 +893,7 @@ tt=nil -- frees tt for GC | |||
| 888 | A = nil | 893 | A = nil |
| 889 | b = nil | 894 | b = nil |
| 890 | T.unref(d); | 895 | T.unref(d); |
| 891 | n5 = T.newuserdata(0) | 896 | local n5 = T.newuserdata(0) |
| 892 | debug.setmetatable(n5, {__gc=F}) | 897 | debug.setmetatable(n5, {__gc=F}) |
| 893 | n5 = T.udataval(n5) | 898 | n5 = T.udataval(n5) |
| 894 | collectgarbage() | 899 | collectgarbage() |
| @@ -959,11 +964,11 @@ print'+' | |||
| 959 | 964 | ||
| 960 | 965 | ||
| 961 | -- testing changing hooks during hooks | 966 | -- testing changing hooks during hooks |
| 962 | _G.t = {} | 967 | _G.TT = {} |
| 963 | T.sethook([[ | 968 | T.sethook([[ |
| 964 | # set a line hook after 3 count hooks | 969 | # set a line hook after 3 count hooks |
| 965 | sethook 4 0 ' | 970 | sethook 4 0 ' |
| 966 | getglobal t; | 971 | getglobal TT; |
| 967 | pushvalue -3; append -2 | 972 | pushvalue -3; append -2 |
| 968 | pushvalue -2; append -2 | 973 | pushvalue -2; append -2 |
| 969 | ']], "c", 3) | 974 | ']], "c", 3) |
| @@ -973,12 +978,13 @@ a = 1 -- count hook (set line hook) | |||
| 973 | a = 1 -- line hook | 978 | a = 1 -- line hook |
| 974 | a = 1 -- line hook | 979 | a = 1 -- line hook |
| 975 | debug.sethook() | 980 | debug.sethook() |
| 976 | t = _G.t | 981 | local t = _G.TT |
| 977 | assert(t[1] == "line") | 982 | assert(t[1] == "line") |
| 978 | line = t[2] | 983 | local line = t[2] |
| 979 | assert(t[3] == "line" and t[4] == line + 1) | 984 | assert(t[3] == "line" and t[4] == line + 1) |
| 980 | assert(t[5] == "line" and t[6] == line + 2) | 985 | assert(t[5] == "line" and t[6] == line + 2) |
| 981 | assert(t[7] == nil) | 986 | assert(t[7] == nil) |
| 987 | _G.TT = nil | ||
| 982 | 988 | ||
| 983 | 989 | ||
| 984 | ------------------------------------------------------------------------- | 990 | ------------------------------------------------------------------------- |
| @@ -1003,6 +1009,7 @@ do -- testing errors during GC | |||
| 1003 | collectgarbage("restart") | 1009 | collectgarbage("restart") |
| 1004 | warn("@on") | 1010 | warn("@on") |
| 1005 | end | 1011 | end |
| 1012 | _G.A = nil | ||
| 1006 | ------------------------------------------------------------------------- | 1013 | ------------------------------------------------------------------------- |
| 1007 | -- test for userdata vals | 1014 | -- test for userdata vals |
| 1008 | do | 1015 | do |
| @@ -1032,8 +1039,8 @@ assert(a == 'alo' and b == '3') | |||
| 1032 | 1039 | ||
| 1033 | T.doremote(L1, "_ERRORMESSAGE = nil") | 1040 | T.doremote(L1, "_ERRORMESSAGE = nil") |
| 1034 | -- error: `sin' is not defined | 1041 | -- error: `sin' is not defined |
| 1035 | a, _, b = T.doremote(L1, "return sin(1)") | 1042 | a, b, c = T.doremote(L1, "return sin(1)") |
| 1036 | assert(a == nil and b == 2) -- 2 == run-time error | 1043 | assert(a == nil and c == 2) -- 2 == run-time error |
| 1037 | 1044 | ||
| 1038 | -- error: syntax error | 1045 | -- error: syntax error |
| 1039 | a, b, c = T.doremote(L1, "return a+") | 1046 | a, b, c = T.doremote(L1, "return a+") |
| @@ -1206,7 +1213,7 @@ T.alloccount() -- remove limit | |||
| 1206 | -- o that we get memory errors in all allocations of a given | 1213 | -- o that we get memory errors in all allocations of a given |
| 1207 | -- task, until there is enough memory to complete the task without | 1214 | -- task, until there is enough memory to complete the task without |
| 1208 | -- errors. | 1215 | -- errors. |
| 1209 | function testbytes (s, f) | 1216 | local function testbytes (s, f) |
| 1210 | collectgarbage() | 1217 | collectgarbage() |
| 1211 | local M = T.totalmem() | 1218 | local M = T.totalmem() |
| 1212 | local oldM = M | 1219 | local oldM = M |
| @@ -1231,7 +1238,7 @@ end | |||
| 1231 | -- task, until there is enough allocations to complete the task without | 1238 | -- task, until there is enough allocations to complete the task without |
| 1232 | -- errors. | 1239 | -- errors. |
| 1233 | 1240 | ||
| 1234 | function testalloc (s, f) | 1241 | local function testalloc (s, f) |
| 1235 | collectgarbage() | 1242 | collectgarbage() |
| 1236 | local M = 0 | 1243 | local M = 0 |
| 1237 | local a,b = nil | 1244 | local a,b = nil |
| @@ -1298,12 +1305,12 @@ end) | |||
| 1298 | -- testing threads | 1305 | -- testing threads |
| 1299 | 1306 | ||
| 1300 | -- get main thread from registry (at index LUA_RIDX_MAINTHREAD == 1) | 1307 | -- get main thread from registry (at index LUA_RIDX_MAINTHREAD == 1) |
| 1301 | mt = T.testC("rawgeti R 1; return 1") | 1308 | local mt = T.testC("rawgeti R 1; return 1") |
| 1302 | assert(type(mt) == "thread" and coroutine.running() == mt) | 1309 | assert(type(mt) == "thread" and coroutine.running() == mt) |
| 1303 | 1310 | ||
| 1304 | 1311 | ||
| 1305 | 1312 | ||
| 1306 | function expand (n,s) | 1313 | local function expand (n,s) |
| 1307 | if n==0 then return "" end | 1314 | if n==0 then return "" end |
| 1308 | local e = string.rep("=", n) | 1315 | local e = string.rep("=", n) |
| 1309 | return string.format("T.doonnewstack([%s[ %s;\n collectgarbage(); %s]%s])\n", | 1316 | return string.format("T.doonnewstack([%s[ %s;\n collectgarbage(); %s]%s])\n", |
| @@ -1313,9 +1320,10 @@ end | |||
| 1313 | G=0; collectgarbage(); a =collectgarbage("count") | 1320 | G=0; collectgarbage(); a =collectgarbage("count") |
| 1314 | load(expand(20,"G=G+1"))() | 1321 | load(expand(20,"G=G+1"))() |
| 1315 | assert(G==20); collectgarbage(); -- assert(gcinfo() <= a+1) | 1322 | assert(G==20); collectgarbage(); -- assert(gcinfo() <= a+1) |
| 1323 | G = nil | ||
| 1316 | 1324 | ||
| 1317 | testamem("running code on new thread", function () | 1325 | testamem("running code on new thread", function () |
| 1318 | return T.doonnewstack("x=1") == 0 -- try to create thread | 1326 | return T.doonnewstack("local x=1") == 0 -- try to create thread |
| 1319 | end) | 1327 | end) |
| 1320 | 1328 | ||
| 1321 | 1329 | ||
| @@ -1329,13 +1337,13 @@ end) | |||
| 1329 | local testprog = [[ | 1337 | local testprog = [[ |
| 1330 | local function foo () return end | 1338 | local function foo () return end |
| 1331 | local t = {"x"} | 1339 | local t = {"x"} |
| 1332 | a = "aaa" | 1340 | AA = "aaa" |
| 1333 | for i = 1, #t do a=a..t[i] end | 1341 | for i = 1, #t do AA = AA .. t[i] end |
| 1334 | return true | 1342 | return true |
| 1335 | ]] | 1343 | ]] |
| 1336 | 1344 | ||
| 1337 | -- testing memory x dofile | 1345 | -- testing memory x dofile |
| 1338 | _G.a = nil | 1346 | _G.AA = nil |
| 1339 | local t =os.tmpname() | 1347 | local t =os.tmpname() |
| 1340 | local f = assert(io.open(t, "w")) | 1348 | local f = assert(io.open(t, "w")) |
| 1341 | f:write(testprog) | 1349 | f:write(testprog) |
| @@ -1345,7 +1353,7 @@ testamem("dofile", function () | |||
| 1345 | return a and a() | 1353 | return a and a() |
| 1346 | end) | 1354 | end) |
| 1347 | assert(os.remove(t)) | 1355 | assert(os.remove(t)) |
| 1348 | assert(_G.a == "aaax") | 1356 | assert(_G.AA == "aaax") |
| 1349 | 1357 | ||
| 1350 | 1358 | ||
| 1351 | -- other generic tests | 1359 | -- other generic tests |
| @@ -1362,6 +1370,8 @@ testamem("dump/undump", function () | |||
| 1362 | return a and a() | 1370 | return a and a() |
| 1363 | end) | 1371 | end) |
| 1364 | 1372 | ||
| 1373 | _G.AA = nil | ||
| 1374 | |||
| 1365 | local t = os.tmpname() | 1375 | local t = os.tmpname() |
| 1366 | testamem("file creation", function () | 1376 | testamem("file creation", function () |
| 1367 | local f = assert(io.open(t, 'w')) | 1377 | local f = assert(io.open(t, 'w')) |
| @@ -1383,7 +1393,7 @@ testamem("constructors", function () | |||
| 1383 | end) | 1393 | end) |
| 1384 | 1394 | ||
| 1385 | local a = 1 | 1395 | local a = 1 |
| 1386 | close = nil | 1396 | local close = nil |
| 1387 | testamem("closure creation", function () | 1397 | testamem("closure creation", function () |
| 1388 | function close (b) | 1398 | function close (b) |
| 1389 | return function (x) return b + x end | 1399 | return function (x) return b + x end |
