aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lapi.h2
-rw-r--r--lcode.c2
-rw-r--r--lfunc.c2
-rw-r--r--lmem.c2
-rw-r--r--loslib.c2
-rw-r--r--ltests.c4
-rw-r--r--testes/api.lua4
-rw-r--r--testes/attrib.lua2
-rw-r--r--testes/big.lua2
-rw-r--r--testes/coroutine.lua2
-rw-r--r--testes/cstack.lua17
-rw-r--r--testes/events.lua2
-rw-r--r--testes/gc.lua2
-rw-r--r--testes/locals.lua2
-rw-r--r--testes/math.lua2
15 files changed, 28 insertions, 21 deletions
diff --git a/lapi.h b/lapi.h
index f48d14fd..41216b27 100644
--- a/lapi.h
+++ b/lapi.h
@@ -19,7 +19,7 @@
19 19
20/* 20/*
21** If a call returns too many multiple returns, the callee may not have 21** If a call returns too many multiple returns, the callee may not have
22** stack space to accomodate all results. In this case, this macro 22** stack space to accommodate all results. In this case, this macro
23** increases its stack space ('L->ci->top'). 23** increases its stack space ('L->ci->top').
24*/ 24*/
25#define adjustresults(L,nres) \ 25#define adjustresults(L,nres) \
diff --git a/lcode.c b/lcode.c
index 25ddfb7a..4fc97e2b 100644
--- a/lcode.c
+++ b/lcode.c
@@ -1509,7 +1509,7 @@ static void codeeq (FuncState *fs, BinOpr opr, expdesc *e1, expdesc *e2) {
1509 lua_assert(e1->k == VK || e1->k == VKINT || e1->k == VKFLT); 1509 lua_assert(e1->k == VK || e1->k == VKINT || e1->k == VKFLT);
1510 swapexps(e1, e2); 1510 swapexps(e1, e2);
1511 } 1511 }
1512 r1 = luaK_exp2anyreg(fs, e1); /* 1nd expression must be in register */ 1512 r1 = luaK_exp2anyreg(fs, e1); /* 1st expression must be in register */
1513 if (isSCnumber(e2, &im, &isfloat)) { 1513 if (isSCnumber(e2, &im, &isfloat)) {
1514 op = OP_EQI; 1514 op = OP_EQI;
1515 r2 = im; /* immediate operand */ 1515 r2 = im; /* immediate operand */
diff --git a/lfunc.c b/lfunc.c
index 0ef73284..60689a7a 100644
--- a/lfunc.c
+++ b/lfunc.c
@@ -165,7 +165,7 @@ static int callclosemth (lua_State *L, StkId level, int status) {
165 if (newstatus != LUA_OK && status == CLOSEPROTECT) /* first error? */ 165 if (newstatus != LUA_OK && status == CLOSEPROTECT) /* first error? */
166 status = newstatus; /* this will be the new error */ 166 status = newstatus; /* this will be the new error */
167 else { 167 else {
168 if (newstatus != LUA_OK) /* supressed error? */ 168 if (newstatus != LUA_OK) /* suppressed error? */
169 luaE_warnerror(L, "__close metamethod"); 169 luaE_warnerror(L, "__close metamethod");
170 /* leave original error (or nil) on top */ 170 /* leave original error (or nil) on top */
171 L->top = restorestack(L, oldtop); 171 L->top = restorestack(L, oldtop);
diff --git a/lmem.c b/lmem.c
index b1d646a5..65bfa524 100644
--- a/lmem.c
+++ b/lmem.c
@@ -26,7 +26,7 @@
26/* 26/*
27** First allocation will fail whenever not building initial state 27** First allocation will fail whenever not building initial state
28** and not shrinking a block. (This fail will trigger 'tryagain' and 28** and not shrinking a block. (This fail will trigger 'tryagain' and
29** a full GC cycle at every alocation.) 29** a full GC cycle at every allocation.)
30*/ 30*/
31static void *firsttry (global_State *g, void *block, size_t os, size_t ns) { 31static void *firsttry (global_State *g, void *block, size_t os, size_t ns) {
32 if (ttisnil(&g->nilvalue) && ns > os) 32 if (ttisnil(&g->nilvalue) && ns > os)
diff --git a/loslib.c b/loslib.c
index 7812d29b..29449e40 100644
--- a/loslib.c
+++ b/loslib.c
@@ -196,7 +196,7 @@ static int os_clock (lua_State *L) {
196*/ 196*/
197 197
198/* 198/*
199** About the overflow check: an overflow cannot occurr when time 199** About the overflow check: an overflow cannot occur when time
200** is represented by a lua_Integer, because either lua_Integer is 200** is represented by a lua_Integer, because either lua_Integer is
201** large enough to represent all int fields or it is not large enough 201** large enough to represent all int fields or it is not large enough
202** to represent a time that cause a field to overflow. However, if 202** to represent a time that cause a field to overflow. However, if
diff --git a/ltests.c b/ltests.c
index bb5dad54..e9b28b14 100644
--- a/ltests.c
+++ b/ltests.c
@@ -476,7 +476,7 @@ static void checkrefs (global_State *g, GCObject *o) {
476/* 476/*
477** Check consistency of an object: 477** Check consistency of an object:
478** - Dead objects can only happen in the 'allgc' list during a sweep 478** - Dead objects can only happen in the 'allgc' list during a sweep
479** phase (controled by the caller through 'maybedead'). 479** phase (controlled by the caller through 'maybedead').
480** - During pause, all objects must be white. 480** - During pause, all objects must be white.
481** - In generational mode: 481** - In generational mode:
482** * objects must be old enough for their lists ('listage'). 482** * objects must be old enough for their lists ('listage').
@@ -783,7 +783,7 @@ static int mem_query (lua_State *L) {
783 return 1; 783 return 1;
784 } 784 }
785 } 785 }
786 return luaL_error(L, "unkown type '%s'", t); 786 return luaL_error(L, "unknown type '%s'", t);
787 } 787 }
788} 788}
789 789
diff --git a/testes/api.lua b/testes/api.lua
index b5657416..9447e42a 100644
--- a/testes/api.lua
+++ b/testes/api.lua
@@ -805,7 +805,7 @@ F = function (x)
805 if A ~= nil then 805 if A ~= nil then
806 assert(type(A) == "userdata") 806 assert(type(A) == "userdata")
807 assert(T.udataval(A) == B) 807 assert(T.udataval(A) == B)
808 debug.getmetatable(A) -- just acess it 808 debug.getmetatable(A) -- just access it
809 end 809 end
810 A = x -- ressucita userdata 810 A = x -- ressucita userdata
811 B = udval 811 B = udval
@@ -1112,7 +1112,7 @@ do
1112 -- non-closable value 1112 -- non-closable value
1113 local a, b = pcall(T.makeCfunc[[ 1113 local a, b = pcall(T.makeCfunc[[
1114 newtable # create non-closable object 1114 newtable # create non-closable object
1115 toclose -1 # mark it to be closed (shoud raise an error) 1115 toclose -1 # mark it to be closed (should raise an error)
1116 abort # will not be executed 1116 abort # will not be executed
1117 ]]) 1117 ]])
1118 assert(a == false and 1118 assert(a == false and
diff --git a/testes/attrib.lua b/testes/attrib.lua
index 76a447c8..b1076c76 100644
--- a/testes/attrib.lua
+++ b/testes/attrib.lua
@@ -28,7 +28,7 @@ do
28 local path = table.concat(t, ";") 28 local path = table.concat(t, ";")
29 -- use that path in a search 29 -- use that path in a search
30 local s, err = package.searchpath("xuxu", path) 30 local s, err = package.searchpath("xuxu", path)
31 -- search fails; check that message has an occurence of 31 -- search fails; check that message has an occurrence of
32 -- '??????????' with ? replaced by xuxu and at least 'max' lines 32 -- '??????????' with ? replaced by xuxu and at least 'max' lines
33 assert(not s and 33 assert(not s and
34 string.find(err, string.rep("xuxu", 10)) and 34 string.find(err, string.rep("xuxu", 10)) and
diff --git a/testes/big.lua b/testes/big.lua
index 150d15dc..39e293ef 100644
--- a/testes/big.lua
+++ b/testes/big.lua
@@ -66,7 +66,7 @@ assert(repstrings * ssize > 2.0^32) -- it should be larger than maximum size
66 66
67local longs = string.rep("\0", ssize) -- create one long string 67local longs = string.rep("\0", ssize) -- create one long string
68 68
69-- create function to concatentate 'repstrings' copies of its argument 69-- create function to concatenate 'repstrings' copies of its argument
70local rep = assert(load( 70local rep = assert(load(
71 "local a = ...; return " .. string.rep("a", repstrings, ".."))) 71 "local a = ...; return " .. string.rep("a", repstrings, "..")))
72 72
diff --git a/testes/coroutine.lua b/testes/coroutine.lua
index 81d848a3..73333c14 100644
--- a/testes/coroutine.lua
+++ b/testes/coroutine.lua
@@ -763,7 +763,7 @@ assert(run(function() return "a" .. "b" .. a .. "c" .. c .. b .. "x" end,
763 {"concat", "concat", "concat"}) == "ab10chello12x") 763 {"concat", "concat", "concat"}) == "ab10chello12x")
764 764
765 765
766do -- a few more tests for comparsion operators 766do -- a few more tests for comparison operators
767 local mt1 = { 767 local mt1 = {
768 __le = function (a,b) 768 __le = function (a,b)
769 coroutine.yield(10) 769 coroutine.yield(10)
diff --git a/testes/cstack.lua b/testes/cstack.lua
index 486abc1d..cd74fd28 100644
--- a/testes/cstack.lua
+++ b/testes/cstack.lua
@@ -4,7 +4,7 @@
4local debug = require "debug" 4local debug = require "debug"
5 5
6print"testing C-stack overflow detection" 6print"testing C-stack overflow detection"
7print"If this test craches, see its file ('cstack.lua')" 7print"If this test crashes, see its file ('cstack.lua')"
8 8
9-- Segmentation faults in these tests probably result from a C-stack 9-- Segmentation faults in these tests probably result from a C-stack
10-- overflow. To avoid these errors, you can use the function 10-- overflow. To avoid these errors, you can use the function
@@ -19,10 +19,13 @@ print"If this test craches, see its file ('cstack.lua')"
19-- higher than 2_000. 19-- higher than 2_000.
20 20
21 21
22-- get and print original limit
22local origlimit = debug.setcstacklimit(400) 23local origlimit = debug.setcstacklimit(400)
23print("default stack limit: " .. origlimit) 24print("default stack limit: " .. origlimit)
24 25
25-- change this value for different limits for this test suite 26-- Do the tests using the original limit. Or else you may want to change
27-- 'currentlimit' to lower values to avoid a seg. fault or to higher
28-- values to check whether they are reliable.
26local currentlimit = origlimit 29local currentlimit = origlimit
27debug.setcstacklimit(currentlimit) 30debug.setcstacklimit(currentlimit)
28print("current stack limit: " .. currentlimit) 31print("current stack limit: " .. currentlimit)
@@ -33,12 +36,14 @@ local function checkerror (msg, f, ...)
33 assert(not s and string.find(err, msg)) 36 assert(not s and string.find(err, msg))
34end 37end
35 38
39-- auxiliary function to keep 'count' on the screen even if the program
40-- crashes.
36local count 41local count
37local back = string.rep("\b", 8) 42local back = string.rep("\b", 8)
38local function progress () 43local function progress ()
39 count = count + 1 44 count = count + 1
40 local n = string.format("%-8d", count) 45 local n = string.format("%-8d", count)
41 io.stderr:write(back, n) 46 io.stderr:write(back, n) -- erase previous value and write new one
42end 47end
43 48
44 49
@@ -46,7 +51,7 @@ do print("testing simple recursion:")
46 count = 0 51 count = 0
47 local function foo () 52 local function foo ()
48 progress() 53 progress()
49 foo() 54 foo() -- do recursive calls until a stack error (or crash)
50 end 55 end
51 checkerror("stack overflow", foo) 56 checkerror("stack overflow", foo)
52 print("\tfinal count: ", count) 57 print("\tfinal count: ", count)
@@ -118,9 +123,11 @@ do print("testing changes in C-stack limit")
118 return n 123 return n
119 end 124 end
120 125
126 -- set limit to 400
121 assert(debug.setcstacklimit(400) == currentlimit) 127 assert(debug.setcstacklimit(400) == currentlimit)
122 local lim400 = check() 128 local lim400 = check()
123 -- a very low limit (given that the several calls to arive here) 129 -- set a very low limit (given that there are already several active
130 -- calls to arrive here)
124 local lowlimit = 38 131 local lowlimit = 38
125 assert(debug.setcstacklimit(lowlimit) == 400) 132 assert(debug.setcstacklimit(lowlimit) == 400)
126 assert(check() < lowlimit - 30) 133 assert(check() < lowlimit - 30)
diff --git a/testes/events.lua b/testes/events.lua
index 7fb54c9a..d0abe1d4 100644
--- a/testes/events.lua
+++ b/testes/events.lua
@@ -182,7 +182,7 @@ assert(~a == a); checkcap{"bnot", a, a}
182assert(a << 3 == a); checkcap{"shl", a, 3} 182assert(a << 3 == a); checkcap{"shl", a, 3}
183assert(1.5 >> a == 1.5); checkcap{"shr", 1.5, a} 183assert(1.5 >> a == 1.5); checkcap{"shr", 1.5, a}
184 184
185-- for comparsion operators, all results are true 185-- for comparison operators, all results are true
186assert(5.0 > a); checkcap{"lt", a, 5.0} 186assert(5.0 > a); checkcap{"lt", a, 5.0}
187assert(a >= 10); checkcap{"le", 10, a} 187assert(a >= 10); checkcap{"le", 10, a}
188assert(a <= -10.0); checkcap{"le", a, -10.0} 188assert(a <= -10.0); checkcap{"le", a, -10.0}
diff --git a/testes/gc.lua b/testes/gc.lua
index bb4e3493..91915c0b 100644
--- a/testes/gc.lua
+++ b/testes/gc.lua
@@ -640,7 +640,7 @@ do
640 assert(getmetatable(o) == tt) 640 assert(getmetatable(o) == tt)
641 -- create new objects during GC 641 -- create new objects during GC
642 local a = 'xuxu'..(10+3)..'joao', {} 642 local a = 'xuxu'..(10+3)..'joao', {}
643 ___Glob = o -- ressurect object! 643 ___Glob = o -- ressurrect object!
644 setmetatable({}, tt) -- creates a new one with same metatable 644 setmetatable({}, tt) -- creates a new one with same metatable
645 print(">>> closing state " .. "<<<\n") 645 print(">>> closing state " .. "<<<\n")
646 end 646 end
diff --git a/testes/locals.lua b/testes/locals.lua
index b769575f..4f103be9 100644
--- a/testes/locals.lua
+++ b/testes/locals.lua
@@ -114,7 +114,7 @@ if rawget(_G, "T") then
114 local t = T.querytab(a) 114 local t = T.querytab(a)
115 115
116 for k,_ in pairs(a) do a[k] = undef end 116 for k,_ in pairs(a) do a[k] = undef end
117 collectgarbage() -- restore GC and collect dead fiels in `a' 117 collectgarbage() -- restore GC and collect dead fields in 'a'
118 for i=0,t-1 do 118 for i=0,t-1 do
119 local k = querytab(a, i) 119 local k = querytab(a, i)
120 assert(k == nil or type(k) == 'number' or k == 'alo') 120 assert(k == nil or type(k) == 'number' or k == 'alo')
diff --git a/testes/math.lua b/testes/math.lua
index c7dc8285..7248787b 100644
--- a/testes/math.lua
+++ b/testes/math.lua
@@ -758,7 +758,7 @@ do -- testing max/min
758 assert(eqT(math.min(maxint, maxint - 1), maxint - 1)) 758 assert(eqT(math.min(maxint, maxint - 1), maxint - 1))
759 assert(eqT(math.min(maxint - 2, maxint, maxint - 1), maxint - 2)) 759 assert(eqT(math.min(maxint - 2, maxint, maxint - 1), maxint - 2))
760end 760end
761-- testing implicit convertions 761-- testing implicit conversions
762 762
763local a,b = '10', '20' 763local a,b = '10', '20'
764assert(a*b == 200 and a+b == 30 and a-b == -10 and a/b == 0.5 and -b == -20) 764assert(a*b == 200 and a+b == 30 and a-b == -10 and a/b == 0.5 and -b == -20)