diff options
Diffstat (limited to 'testes')
-rw-r--r-- | testes/code.lua | 6 | ||||
-rw-r--r-- | testes/locals.lua | 9 |
2 files changed, 14 insertions, 1 deletions
diff --git a/testes/code.lua b/testes/code.lua index 6bd6ebfa..ad484485 100644 --- a/testes/code.lua +++ b/testes/code.lua | |||
@@ -64,8 +64,12 @@ end | |||
64 | 64 | ||
65 | 65 | ||
66 | -- some basic instructions | 66 | -- some basic instructions |
67 | check(function () | 67 | check(function () -- function does not create upvalues |
68 | (function () end){f()} | 68 | (function () end){f()} |
69 | end, 'CLOSURE', 'NEWTABLE', 'GETTABUP', 'CALL', 'SETLIST', 'CALL', 'RETURN0') | ||
70 | |||
71 | check(function (x) -- function creates upvalues | ||
72 | (function () return x end){f()} | ||
69 | end, 'CLOSURE', 'NEWTABLE', 'GETTABUP', 'CALL', 'SETLIST', 'CALL', 'RETURN') | 73 | end, 'CLOSURE', 'NEWTABLE', 'GETTABUP', 'CALL', 'SETLIST', 'CALL', 'RETURN') |
70 | 74 | ||
71 | 75 | ||
diff --git a/testes/locals.lua b/testes/locals.lua index 14e49a7c..20ecae4b 100644 --- a/testes/locals.lua +++ b/testes/locals.lua | |||
@@ -173,6 +173,15 @@ end | |||
173 | assert(x==20) | 173 | assert(x==20) |
174 | 174 | ||
175 | 175 | ||
176 | -- tests for to-be-closed variables | ||
177 | do | ||
178 | local scoped x = 3 | ||
179 | local a | ||
180 | local scoped y = 5 | ||
181 | assert(x == 3 and y == 5) | ||
182 | end | ||
183 | |||
184 | |||
176 | print('OK') | 185 | print('OK') |
177 | 186 | ||
178 | return 5,f | 187 | return 5,f |