aboutsummaryrefslogtreecommitdiff
path: root/testes
diff options
context:
space:
mode:
Diffstat (limited to 'testes')
-rw-r--r--testes/bwcoercion.lua2
-rw-r--r--testes/calls.lua4
-rw-r--r--testes/files.lua4
-rw-r--r--testes/goto.lua23
-rw-r--r--testes/tracegc.lua2
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
5local print = print 5local print = print
6 6
7_ENV = nil 7global 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.
10local function toint (x) 10local 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
27global fact; fact = false 27global fact = false
28do 28do
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
66print('+') 66print('+')
67 67
68global t; t = nil -- 'declare' t 68global t = nil -- 'declare' t
69function f(a,b,c) local d = 'a'; t={a,b,c,d} end 69function f(a,b,c) local d = 'a'; t={a,b,c,d} end
70 70
71f( -- this line change must be valid 71f( -- 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
715end 715end
716 716
717 717
718if T and T.nonblock then 718if 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")
840local x = string.rep("a", 10000) 840local x = string.rep("a", 10000)
841assert(os.date(x) == x) 841assert(os.date(x) == x)
842local t = os.time() 842local t = os.time()
843global D; D = os.date("*t", t) 843global D = os.date("*t", t)
844assert(os.date(string.rep("%d", 1000), t) == 844assert(os.date(string.rep("%d", 1000), t) ==
845 string.rep(os.date("%d", t), 1000)) 845 string.rep(os.date("%d", t), 1000))
846assert(os.date(string.rep("%", 200)) == string.rep("%", 100)) 846assert(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
384end 384end
385 385
386 386
@@ -411,5 +411,26 @@ do -- mixing lots of global/local declarations
411 _ENV.x200 = nil 411 _ENV.x200 = nil
412end 412end
413 413
414do 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
433end
434
414print'OK' 435print'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 = {}
6local setmetatable, stderr, collectgarbage = 6local setmetatable, stderr, collectgarbage =
7 setmetatable, io.stderr, collectgarbage 7 setmetatable, io.stderr, collectgarbage
8 8
9_ENV = nil 9global none
10 10
11local active = false 11local active = false
12 12