diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-02-27 12:59:22 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-02-27 12:59:22 -0300 |
commit | 6eb53b752617fae9e1329bfe2cfecdcbb593c398 (patch) | |
tree | c392ef632bbcfbf7b3716f5c6c17b06617bca8da /testes | |
parent | 9b7987a9d1471ba94764286b28e0998f73deb46a (diff) | |
download | lua-6eb53b752617fae9e1329bfe2cfecdcbb593c398.tar.gz lua-6eb53b752617fae9e1329bfe2cfecdcbb593c398.tar.bz2 lua-6eb53b752617fae9e1329bfe2cfecdcbb593c398.zip |
Details
Several details in code (e.g., moving a variable to the most inner
scope that encloses its uses), comments, parameter names, extra tests.
Diffstat (limited to 'testes')
-rw-r--r-- | testes/db.lua | 5 | ||||
-rw-r--r-- | testes/events.lua | 1 | ||||
-rw-r--r-- | testes/math.lua | 4 | ||||
-rw-r--r-- | testes/nextvar.lua | 2 |
4 files changed, 11 insertions, 1 deletions
diff --git a/testes/db.lua b/testes/db.lua index 074a6d0b..941283f7 100644 --- a/testes/db.lua +++ b/testes/db.lua | |||
@@ -649,6 +649,11 @@ t = debug.getinfo(1) -- main | |||
649 | assert(t.isvararg == true and t.nparams == 0 and t.nups == 1 and | 649 | assert(t.isvararg == true and t.nparams == 0 and t.nups == 1 and |
650 | debug.getupvalue(t.func, 1) == "_ENV") | 650 | debug.getupvalue(t.func, 1) == "_ENV") |
651 | 651 | ||
652 | t = debug.getinfo(math.sin) -- C function | ||
653 | assert(t.isvararg == true and t.nparams == 0 and t.nups == 0) | ||
654 | |||
655 | t = debug.getinfo(string.gmatch("abc", "a")) -- C closure | ||
656 | assert(t.isvararg == true and t.nparams == 0 and t.nups > 0) | ||
652 | 657 | ||
653 | 658 | ||
654 | 659 | ||
diff --git a/testes/events.lua b/testes/events.lua index d0abe1d4..8a01330e 100644 --- a/testes/events.lua +++ b/testes/events.lua | |||
@@ -325,6 +325,7 @@ else | |||
325 | assert(u1 == u3 and u3 == u1 and u1 ~= u2) | 325 | assert(u1 == u3 and u3 == u1 and u1 ~= u2) |
326 | assert(u2 == u1 and u2 == u3 and u3 == u2) | 326 | assert(u2 == u1 and u2 == u3 and u3 == u2) |
327 | assert(u2 ~= {}) -- different types cannot be equal | 327 | assert(u2 ~= {}) -- different types cannot be equal |
328 | assert(rawequal(u1, u1) and not rawequal(u1, u3)) | ||
328 | 329 | ||
329 | local mirror = {} | 330 | local mirror = {} |
330 | debug.setmetatable(u3, {__index = mirror, __newindex = mirror}) | 331 | debug.setmetatable(u3, {__index = mirror, __newindex = mirror}) |
diff --git a/testes/math.lua b/testes/math.lua index 7248787b..930221e3 100644 --- a/testes/math.lua +++ b/testes/math.lua | |||
@@ -960,7 +960,10 @@ do | |||
960 | aux(-10,0) | 960 | aux(-10,0) |
961 | aux(1, 6) | 961 | aux(1, 6) |
962 | aux(1, 2) | 962 | aux(1, 2) |
963 | aux(1, 13) | ||
964 | aux(1, 31) | ||
963 | aux(1, 32) | 965 | aux(1, 32) |
966 | aux(1, 33) | ||
964 | aux(-10, 10) | 967 | aux(-10, 10) |
965 | aux(-10,-10) -- unit set | 968 | aux(-10,-10) -- unit set |
966 | aux(minint, minint) -- unit set | 969 | aux(minint, minint) -- unit set |
@@ -998,6 +1001,7 @@ do | |||
998 | end | 1001 | end |
999 | aux(0, maxint) | 1002 | aux(0, maxint) |
1000 | aux(1, maxint) | 1003 | aux(1, maxint) |
1004 | aux(3, maxint // 3) | ||
1001 | aux(minint, -1) | 1005 | aux(minint, -1) |
1002 | aux(minint // 2, maxint // 2) | 1006 | aux(minint // 2, maxint // 2) |
1003 | aux(minint, maxint) | 1007 | aux(minint, maxint) |
diff --git a/testes/nextvar.lua b/testes/nextvar.lua index 9d919631..73af77dd 100644 --- a/testes/nextvar.lua +++ b/testes/nextvar.lua | |||
@@ -76,7 +76,7 @@ end | |||
76 | 76 | ||
77 | -- testing constructor sizes | 77 | -- testing constructor sizes |
78 | local sizes = {0, 1, 2, 3, 4, 5, 7, 8, 9, 15, 16, 17, | 78 | local sizes = {0, 1, 2, 3, 4, 5, 7, 8, 9, 15, 16, 17, |
79 | 30, 31, 32, 33, 34, 500, 1000} | 79 | 30, 31, 32, 33, 34, 254, 255, 256, 500, 1000} |
80 | 80 | ||
81 | for _, sa in ipairs(sizes) do -- 'sa' is size of the array part | 81 | for _, sa in ipairs(sizes) do -- 'sa' is size of the array part |
82 | local arr = {"return {"} | 82 | local arr = {"return {"} |