Add Space Lua benchmarks based on Deno.bench aligned to Deno.test (#1649)

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
This commit is contained in:
Matouš Jan Fialka
2025-11-05 15:06:33 +01:00
committed by GitHub
parent df28a3f04d
commit 3422a9fa20
4 changed files with 102 additions and 4 deletions
+5 -4
View File
@@ -215,21 +215,22 @@ assert(t.bar == "bar")
assertEqual(t.foo, "Key not found: foo")
-- Test the __newindex metamethod
t = setmetatable(
t, c = setmetatable(
{}, {
__newindex = function(table, key, value)
print("Raw set", key, value)
c = c + 1
rawset(table, key, "Value: " .. value)
print("Raw set done")
c = c + 1
end
}
)
), 0
t.name = "John"
-- rawset ignores the metamethod
rawset(t, "age", 100)
assertEqual(t.name, "Value: John")
assertEqual(t.age, 100)
assertEqual(c, 2)
-- Test some of the operator metamethods
t = setmetatable(