diff options
Diffstat (limited to 'testes/goto.lua')
-rw-r--r-- | testes/goto.lua | 23 |
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 | |
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 | ||