forked from github/server
9b7a4e813b
functional test for forced leave after combat. functional test for MAKE TEMP. error handling for Lua function building.create(). reduce some errors to warnings. initialize race.battle_flags correctly (when not created through XML). re-initialize processor in case config has changed. handle missing translation of combat status, with error message.
38 lines
864 B
Lua
38 lines
864 B
Lua
require "lunit"
|
|
|
|
module("tests.eressea.config", package.seeall, lunit.testcase )
|
|
|
|
function setup()
|
|
eressea.free_game()
|
|
end
|
|
|
|
function test_read_race()
|
|
local f
|
|
eressea.free_game()
|
|
f = faction.create("orc@example.com", "orc", "en")
|
|
assert_equal(nil, f)
|
|
assert_not_nil(eressea.config)
|
|
eressea.config.parse('{ "races": { "orc" : {}}}')
|
|
f = faction.create("orc@example.com", "orc", "en")
|
|
assert_not_nil(f)
|
|
end
|
|
|
|
function test_read_ship()
|
|
local s
|
|
eressea.free_game()
|
|
s = ship.create(nil, "boat")
|
|
assert_equal(nil, s)
|
|
assert_not_nil(eressea.config)
|
|
conf = [[{
|
|
"ships": {
|
|
"boat" : {
|
|
"construction" : {
|
|
"maxsize" : 20
|
|
}
|
|
}
|
|
}
|
|
}]]
|
|
eressea.config.parse(conf);
|
|
s = ship.create(nil, "boat")
|
|
assert_not_nil(s)
|
|
end
|