diff options
Diffstat (limited to 'testes')
-rw-r--r-- | testes/bwcoercion.lua | 2 | ||||
-rw-r--r-- | testes/calls.lua | 4 | ||||
-rw-r--r-- | testes/files.lua | 4 | ||||
-rw-r--r-- | testes/goto.lua | 23 | ||||
-rw-r--r-- | testes/tracegc.lua | 2 |
5 files changed, 28 insertions, 7 deletions
diff --git a/testes/bwcoercion.lua b/testes/bwcoercion.lua index cd735ab0..0544944d 100644 --- a/testes/bwcoercion.lua +++ b/testes/bwcoercion.lua | |||
@@ -4,7 +4,7 @@ local strsub = string.sub | |||
4 | 4 | ||
5 | local print = print | 5 | local print = print |
6 | 6 | ||
7 | _ENV = nil | 7 | global none |
8 | 8 | ||
9 | -- Try to convert a value to an integer, without assuming any coercion. | 9 | -- Try to convert a value to an integer, without assuming any coercion. |
10 | local function toint (x) | 10 | local function toint (x) |
diff --git a/testes/calls.lua b/testes/calls.lua index 21441701..0dacb85a 100644 --- a/testes/calls.lua +++ b/testes/calls.lua | |||
@@ -24,7 +24,7 @@ assert(not pcall(type)) | |||
24 | 24 | ||
25 | 25 | ||
26 | -- testing local-function recursion | 26 | -- testing local-function recursion |
27 | global fact; fact = false | 27 | global fact = false |
28 | do | 28 | do |
29 | local res = 1 | 29 | local res = 1 |
30 | local function fact (n) | 30 | local function fact (n) |
@@ -65,7 +65,7 @@ a.b.c:f2('k', 12); assert(a.b.c.k == 12) | |||
65 | 65 | ||
66 | print('+') | 66 | print('+') |
67 | 67 | ||
68 | global t; t = nil -- 'declare' t | 68 | global t = nil -- 'declare' t |
69 | function f(a,b,c) local d = 'a'; t={a,b,c,d} end | 69 | function f(a,b,c) local d = 'a'; t={a,b,c,d} end |
70 | 70 | ||
71 | f( -- this line change must be valid | 71 | f( -- this line change must be valid |
diff --git a/testes/files.lua b/testes/files.lua index d4e327b7..7146ac7c 100644 --- a/testes/files.lua +++ b/testes/files.lua | |||
@@ -715,7 +715,7 @@ do | |||
715 | end | 715 | end |
716 | 716 | ||
717 | 717 | ||
718 | if T and T.nonblock then | 718 | if T and T.nonblock and not _port then |
719 | print("testing failed write") | 719 | print("testing failed write") |
720 | 720 | ||
721 | -- unable to write anything to /dev/full | 721 | -- unable to write anything to /dev/full |
@@ -840,7 +840,7 @@ assert(os.date("!\0\0") == "\0\0") | |||
840 | local x = string.rep("a", 10000) | 840 | local x = string.rep("a", 10000) |
841 | assert(os.date(x) == x) | 841 | assert(os.date(x) == x) |
842 | local t = os.time() | 842 | local t = os.time() |
843 | global D; D = os.date("*t", t) | 843 | global D = os.date("*t", t) |
844 | assert(os.date(string.rep("%d", 1000), t) == | 844 | assert(os.date(string.rep("%d", 1000), t) == |
845 | string.rep(os.date("%d", t), 1000)) | 845 | string.rep(os.date("%d", t), 1000)) |
846 | assert(os.date(string.rep("%", 200)) == string.rep("%", 100)) | 846 | assert(os.date(string.rep("%", 200)) == string.rep("%", 100)) |
diff --git a/testes/goto.lua b/testes/goto.lua index 3519e75d..3310314d 100644 --- a/testes/goto.lua +++ b/testes/goto.lua | |||
@@ -380,7 +380,7 @@ do | |||
380 | global * | 380 | global * |
381 | Y = x + Y | 381 | Y = x + Y |
382 | assert(_ENV.Y == 20) | 382 | assert(_ENV.Y == 20) |
383 | 383 | Y = nil | |
384 | end | 384 | end |
385 | 385 | ||
386 | 386 | ||
@@ -411,5 +411,26 @@ do -- mixing lots of global/local declarations | |||
411 | _ENV.x200 = nil | 411 | _ENV.x200 = nil |
412 | end | 412 | end |
413 | 413 | ||
414 | do print "testing initialization in global declarations" | ||
415 | global<const> a, b, c = 10, 20, 30 | ||
416 | assert(_ENV.a == 10 and b == 20 and c == 30) | ||
417 | |||
418 | global<const> a, b, c = 10 | ||
419 | assert(_ENV.a == 10 and b == nil and c == nil) | ||
420 | |||
421 | global table | ||
422 | global a, b, c, d = table.unpack{1, 2, 3, 6, 5} | ||
423 | assert(_ENV.a == 1 and b == 2 and c == 3 and d == 6) | ||
424 | |||
425 | local a, b = 100, 200 | ||
426 | do | ||
427 | global a, b = a, b | ||
428 | end | ||
429 | assert(_ENV.a == 100 and _ENV.b == 200) | ||
430 | |||
431 | |||
432 | _ENV.a, _ENV.b, _ENV.c, _ENV.d = nil -- erase these globals | ||
433 | end | ||
434 | |||
414 | print'OK' | 435 | print'OK' |
415 | 436 | ||
diff --git a/testes/tracegc.lua b/testes/tracegc.lua index 9c5c1b3f..a8c929df 100644 --- a/testes/tracegc.lua +++ b/testes/tracegc.lua | |||
@@ -6,7 +6,7 @@ local M = {} | |||
6 | local setmetatable, stderr, collectgarbage = | 6 | local setmetatable, stderr, collectgarbage = |
7 | setmetatable, io.stderr, collectgarbage | 7 | setmetatable, io.stderr, collectgarbage |
8 | 8 | ||
9 | _ENV = nil | 9 | global none |
10 | 10 | ||
11 | local active = false | 11 | local active = false |
12 | 12 | ||