Clean up tests

This commit is contained in:
Lars Mueller 2022-02-28 11:01:03 +01:00
parent f53ea61fbe
commit 5efc048887

@ -304,7 +304,7 @@ local function serializer_test(is_json, preserve)
local mixed = {1, 2, 3} local mixed = {1, 2, 3}
mixed[mixed] = mixed mixed[mixed] = mixed
mixed.vec = {x = 1, y = 2, z = 3} mixed.vec = {x = 1, y = 2, z = 3}
mixed.vec2 = modlib.table.copy(mixed.vec) mixed.vec2 = table.copy(mixed.vec)
mixed.blah = "blah" mixed.blah = "blah"
assert_preserves(mixed) assert_preserves(mixed)
local a, b, c = {}, {}, {} local a, b, c = {}, {}, {}
@ -424,7 +424,7 @@ test_logfile(false)
-- SQLite3 -- SQLite3
do do
local sqlite3 = persistence.sqlite3() local sqlite3 = persistence.sqlite3()
local path = modlib.mod.get_resource("modlib", "database.test.sqlite3") local path = mod.get_resource("modlib", "database.test.sqlite3")
local p = sqlite3.new(path, {}) local p = sqlite3.new(path, {})
p:init() p:init()
p:rewrite() p:rewrite()
@ -451,7 +451,7 @@ do
for row in p.database:rows("SELECT * FROM table_entries ORDER BY table_id, key_type, key") do for row in p.database:rows("SELECT * FROM table_entries ORDER BY table_id, key_type, key") do
_G.table.insert(rows, row) _G.table.insert(rows, row)
end end
assert(modlib.table.equals(rows, { assert(table.equals(rows, {
{ 1, 3, "key", 4, 2 }, { 1, 3, "key", 4, 2 },
{ 1, 3, "other key", 3, "other value" }, { 1, 3, "other key", 3, "other value" },
{ 2, 3, "a", 2, 1 }, { 2, 3, "a", 2, 1 },
@ -461,7 +461,7 @@ do
p:close() p:close()
p = sqlite3.new(path, {}) p = sqlite3.new(path, {})
p:init() p:init()
assert(modlib.table.equals(p.root, { assert(table.equals(p.root, {
key = { a = 1, b = 2, c = 3 }, key = { a = 1, b = 2, c = 3 },
["other key"] = "other value", ["other key"] = "other value",
})) }))