From 6eb53b752617fae9e1329bfe2cfecdcbb593c398 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 27 Feb 2020 12:59:22 -0300 Subject: Details Several details in code (e.g., moving a variable to the most inner scope that encloses its uses), comments, parameter names, extra tests. --- testes/db.lua | 5 +++++ testes/events.lua | 1 + testes/math.lua | 4 ++++ testes/nextvar.lua | 2 +- 4 files changed, 11 insertions(+), 1 deletion(-) (limited to 'testes') 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 assert(t.isvararg == true and t.nparams == 0 and t.nups == 1 and debug.getupvalue(t.func, 1) == "_ENV") +t = debug.getinfo(math.sin) -- C function +assert(t.isvararg == true and t.nparams == 0 and t.nups == 0) + +t = debug.getinfo(string.gmatch("abc", "a")) -- C closure +assert(t.isvararg == true and t.nparams == 0 and t.nups > 0) 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 assert(u1 == u3 and u3 == u1 and u1 ~= u2) assert(u2 == u1 and u2 == u3 and u3 == u2) assert(u2 ~= {}) -- different types cannot be equal + assert(rawequal(u1, u1) and not rawequal(u1, u3)) local mirror = {} 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 aux(-10,0) aux(1, 6) aux(1, 2) + aux(1, 13) + aux(1, 31) aux(1, 32) + aux(1, 33) aux(-10, 10) aux(-10,-10) -- unit set aux(minint, minint) -- unit set @@ -998,6 +1001,7 @@ do end aux(0, maxint) aux(1, maxint) + aux(3, maxint // 3) aux(minint, -1) aux(minint // 2, maxint // 2) 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 -- testing constructor sizes local sizes = {0, 1, 2, 3, 4, 5, 7, 8, 9, 15, 16, 17, - 30, 31, 32, 33, 34, 500, 1000} + 30, 31, 32, 33, 34, 254, 255, 256, 500, 1000} for _, sa in ipairs(sizes) do -- 'sa' is size of the array part local arr = {"return {"} -- cgit v1.2.3-55-g6feb