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

Various improvements to push_json_value

This commit is contained in:
sfan5 2024-10-12 22:26:17 +02:00
parent d95e916a42
commit cbc741f464
2 changed files with 35 additions and 22 deletions

View file

@ -153,6 +153,18 @@ local function test_urlencode()
end
unittests.register("test_urlencode", test_urlencode)
local function test_parse_json()
local raw = "{\"how\\u0000weird\":\n\"yes\\u0000really\",\"n\":-1234567891011,\"z\":null}"
local data = core.parse_json(raw)
assert(data["how\000weird"] == "yes\000really")
assert(data.n == -1234567891011)
assert(data.z == nil)
local null = {}
data = core.parse_json(raw, null)
assert(data.z == null)
end
unittests.register("test_parse_json", test_parse_json)
local function test_game_info()
local info = minetest.get_game_info()
local game_conf = Settings(info.path .. "/game.conf")