aboutsummaryrefslogtreecommitdiff
path: root/testes/goto.lua
diff options
context:
space:
mode:
Diffstat (limited to 'testes/goto.lua')
-rw-r--r--testes/goto.lua23
1 files changed, 22 insertions, 1 deletions
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