diff options
Diffstat (limited to 'testes/goto.lua')
| -rw-r--r-- | testes/goto.lua | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/testes/goto.lua b/testes/goto.lua index d7730061..7e40fc4f 100644 --- a/testes/goto.lua +++ b/testes/goto.lua | |||
| @@ -364,7 +364,23 @@ do | |||
| 364 | print(X) -- Ok to use | 364 | print(X) -- Ok to use |
| 365 | Y = 1 -- ERROR | 365 | Y = 1 -- ERROR |
| 366 | ]], "assign to const variable 'Y'") | 366 | ]], "assign to const variable 'Y'") |
| 367 | 367 | ||
| 368 | checkerr([[ | ||
| 369 | global *; | ||
| 370 | Y = X -- Ok to use | ||
| 371 | global<const> *; | ||
| 372 | Y = 1 -- ERROR | ||
| 373 | ]], "assign to const variable 'Y'") | ||
| 374 | |||
| 375 | global * | ||
| 376 | Y = 10 | ||
| 377 | assert(_ENV.Y == 10) | ||
| 378 | global<const> * | ||
| 379 | local x = Y | ||
| 380 | global * | ||
| 381 | Y = x + Y | ||
| 382 | assert(_ENV.Y == 20) | ||
| 383 | |||
| 368 | end | 384 | end |
| 369 | 385 | ||
| 370 | print'OK' | 386 | print'OK' |
