1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

JSON: Support consistent larger max. depth of 1024

This commit is contained in:
Lars Mueller 2024-10-14 15:46:25 +02:00 committed by Lars Müller
parent 4c419c4020
commit e2ea359925
4 changed files with 30 additions and 8 deletions

View file

@ -174,6 +174,21 @@ local function test_parse_json()
end
unittests.register("test_parse_json", test_parse_json)
local function test_write_json()
-- deeply nested structures should be preserved
local leaf = 42
local data = leaf
for i = 1, 1000 do
data = {data}
end
local roundtripped = minetest.parse_json(minetest.write_json(data))
for i = 1, 1000 do
roundtripped = roundtripped[1]
end
assert(roundtripped == 42)
end
unittests.register("test_write_json", test_write_json)
local function test_game_info()
local info = minetest.get_game_info()
local game_conf = Settings(info.path .. "/game.conf")