From c810b7284562bd86c502017384e7bda30c179c85 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 26 Feb 2011 22:57:42 -0800 Subject: [PATCH] Some test requires that a cart exists. Meropis gets its own list of items. --- res/common/items.xml | 8 -------- res/common/resources.xml | 6 +++++- res/resources/cart.xml | 8 ++++++++ scripts/tests/bson.lua | 8 +++++--- scripts/tests/common.lua | 4 ++++ 5 files changed, 22 insertions(+), 12 deletions(-) create mode 100644 res/resources/cart.xml diff --git a/res/common/items.xml b/res/common/items.xml index 7c57a8184..2a96de46d 100644 --- a/res/common/items.xml +++ b/res/common/items.xml @@ -121,14 +121,6 @@ - - - - - - - - diff --git a/res/common/resources.xml b/res/common/resources.xml index bc39933e6..91d0e8afc 100644 --- a/res/common/resources.xml +++ b/res/common/resources.xml @@ -1,7 +1,11 @@ - + + diff --git a/res/resources/cart.xml b/res/resources/cart.xml new file mode 100644 index 000000000..a72b222d3 --- /dev/null +++ b/res/resources/cart.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/scripts/tests/bson.lua b/scripts/tests/bson.lua index 35b08051c..a7c12d75c 100644 --- a/scripts/tests/bson.lua +++ b/scripts/tests/bson.lua @@ -22,13 +22,15 @@ function test_illegal_arg() end function test_bson_readwrite() - local r = region.create(0, 0, "mountain") + local i, r = region.create(0, 0, "mountain") attrib.create(r, 42) - write_game("test_read_write.dat") + i = write_game("test_read_write.dat") + assert_equal(0, i) free_game() r = get_region(0, 0) assert_equal(nil, r) - read_game("test_read_write.dat") + i = read_game("test_read_write.dat") + assert_equal(0, i) r = get_region(0, 0) assert_not_equal(nil, r) for a in attrib.get(r) do diff --git a/scripts/tests/common.lua b/scripts/tests/common.lua index f15eb8164..c2cfabe8c 100644 --- a/scripts/tests/common.lua +++ b/scripts/tests/common.lua @@ -717,8 +717,11 @@ function test_ride_with_horses_and_cart() local f = faction.create("noreply@eressea.de", "human", "de") local u = unit.create(f, r, 1) u:add_item("cart", 1) + assert_equal(1, u:get_item("cart")) -- every game has a cart, right? right? u:add_item("horse", 2) + assert_equal(2, u:get_item("horse")) -- every game has a horse, right? right? u:add_item("sword", 120) + assert_equal(120, u:get_item("sword")) -- every game has a sword, right? and it weighs 1 unit? u:set_skill("riding", 3) -- ride @@ -824,6 +827,7 @@ module("tests.parser", package.seeall, lunit.testcase) function setup() free_game() + settings.set("rules.economy.food", "4") -- FOOD_IS_FREE end function test_parser()