diff options
Diffstat (limited to 'testes')
-rw-r--r-- | testes/code.lua | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/testes/code.lua b/testes/code.lua index b5091458..57923b14 100644 --- a/testes/code.lua +++ b/testes/code.lua | |||
@@ -8,7 +8,8 @@ end | |||
8 | print "testing code generation and optimizations" | 8 | print "testing code generation and optimizations" |
9 | 9 | ||
10 | -- to test constant propagation | 10 | -- to test constant propagation |
11 | local <const> k0 = 0 | 11 | local <const> k0aux = 0 |
12 | local <const> k0 = k0aux | ||
12 | local <const> k1 = 1 | 13 | local <const> k1 = 1 |
13 | local <const> k3 = 3 | 14 | local <const> k3 = 3 |
14 | local <const> k6 = k3 + (k3 << k0) | 15 | local <const> k6 = k3 + (k3 << k0) |
@@ -410,8 +411,9 @@ checkequal(function () return 6 and true or nil end, | |||
410 | 411 | ||
411 | 412 | ||
412 | do -- string constants | 413 | do -- string constants |
414 | local <const> k0 = "00000000000000000000000000000000000000000000000000" | ||
413 | local function f1 () | 415 | local function f1 () |
414 | local <const> k = "00000000000000000000000000000000000000000000000000" | 416 | local <const> k = k0 |
415 | return function () | 417 | return function () |
416 | return function () return k end | 418 | return function () return k end |
417 | end | 419 | end |
@@ -419,8 +421,8 @@ do -- string constants | |||
419 | 421 | ||
420 | local f2 = f1() | 422 | local f2 = f1() |
421 | local f3 = f2() | 423 | local f3 = f2() |
422 | assert(f3() == string.rep("0", 50)) | 424 | assert(f3() == k0) |
423 | checkK(f3, f3()) | 425 | checkK(f3, k0) |
424 | -- string is not needed by other functions | 426 | -- string is not needed by other functions |
425 | assert(T.listk(f1)[1] == nil) | 427 | assert(T.listk(f1)[1] == nil) |
426 | assert(T.listk(f2)[1] == nil) | 428 | assert(T.listk(f2)[1] == nil) |