mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-06 17:41:04 +00:00
Use JSON for favorites, move server list code to Lua (#10085)
Co-authored-by: sfan5 <sfan5@live.de>
This commit is contained in:
parent
4fcd000e20
commit
67aa75d444
17 changed files with 388 additions and 528 deletions
36
builtin/mainmenu/tests/serverlistmgr_spec.lua
Normal file
36
builtin/mainmenu/tests/serverlistmgr_spec.lua
Normal file
|
@ -0,0 +1,36 @@
|
|||
_G.core = {}
|
||||
_G.unpack = table.unpack
|
||||
_G.serverlistmgr = {}
|
||||
|
||||
dofile("builtin/common/misc_helpers.lua")
|
||||
dofile("builtin/mainmenu/serverlistmgr.lua")
|
||||
|
||||
local base = "builtin/mainmenu/tests/"
|
||||
|
||||
describe("legacy favorites", function()
|
||||
it("loads well-formed correctly", function()
|
||||
local favs = serverlistmgr.read_legacy_favorites(base .. "favorites_wellformed.txt")
|
||||
|
||||
local expected = {
|
||||
{
|
||||
address = "127.0.0.1",
|
||||
port = 30000,
|
||||
},
|
||||
|
||||
{ address = "localhost", port = 30000 },
|
||||
|
||||
{ address = "vps.rubenwardy.com", port = 30001 },
|
||||
|
||||
{ address = "gundul.ddnss.de", port = 39155 },
|
||||
|
||||
{
|
||||
address = "daconcepts.com",
|
||||
port = 30000,
|
||||
name = "VanessaE's Dreambuilder creative Server",
|
||||
description = "VanessaE's Dreambuilder creative-mode server. Lots of mods, whitelisted buckets."
|
||||
},
|
||||
}
|
||||
|
||||
assert.same(expected, favs)
|
||||
end)
|
||||
end)
|
Loading…
Add table
Add a link
Reference in a new issue