mirror of
https://github.com/appgurueu/modlib.git
synced 2024-11-29 10:43:43 +01:00
Add circular test for Lua log file
This commit is contained in:
parent
e49d75a822
commit
d852c081ed
9
test.lua
9
test.lua
@ -230,9 +230,16 @@ local function test_logfile(reference_strings)
|
|||||||
logfile.root = {a_longer_string = "test"}
|
logfile.root = {a_longer_string = "test"}
|
||||||
logfile:rewrite()
|
logfile:rewrite()
|
||||||
logfile:set_root({a = 1}, {b = 2, c = 3, d = _G.math.huge, e = -_G.math.huge})
|
logfile:set_root({a = 1}, {b = 2, c = 3, d = _G.math.huge, e = -_G.math.huge})
|
||||||
|
local circular = {}
|
||||||
|
circular[circular] = circular
|
||||||
|
logfile:set_root(circular, circular)
|
||||||
logfile:close()
|
logfile:close()
|
||||||
logfile:init()
|
logfile:init()
|
||||||
assert(table.equals(logfile.root, {a_longer_string = "test", [{a = 1}] = {b = 2, c = 3, d = _G.math.huge, e = -_G.math.huge}}))
|
assert(table.equals_references(logfile.root, {
|
||||||
|
a_longer_string = "test",
|
||||||
|
[{a = 1}] = {b = 2, c = 3, d = _G.math.huge, e = -_G.math.huge},
|
||||||
|
[circular] = circular,
|
||||||
|
}))
|
||||||
if not reference_strings then
|
if not reference_strings then
|
||||||
for key in pairs(logfile.references) do
|
for key in pairs(logfile.references) do
|
||||||
assert(type(key) ~= "string")
|
assert(type(key) ~= "string")
|
||||||
|
Loading…
Reference in New Issue
Block a user