diff --git a/CMakeLists.txt b/CMakeLists.txt index e8c4893d7..0edbe230c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,7 +48,9 @@ endif() find_package(EXPAT REQUIRED) find_package (ToLua REQUIRED) if (TOLUA_FOUND) -if (${TOLUA_VERSION_STRING} VERSION_EQUAL "5.2") +if (${TOLUA_VERSION_STRING} VERSION_EQUAL "5.3") +find_package (Lua 5.3 REQUIRED) +elseif (${TOLUA_VERSION_STRING} VERSION_EQUAL "5.2") find_package (Lua 5.2 REQUIRED) elseif (${TOLUA_VERSION_STRING} VERSION_EQUAL "5.3") find_package ( Lua 5.3 REQUIRED) diff --git a/s/cmake-init b/s/cmake-init index 9d64a9666..00e6d3d06 100755 --- a/s/cmake-init +++ b/s/cmake-init @@ -78,17 +78,16 @@ DEST=$(dirname $ROOT)/server LUA_VERSION="5.2" LUA_INCLUDE=/usr/include LUA_DIR=/usr -if [ -d /usr/include/lua5.1 ]; then - LUA_VERSION="5.1" - LUA_INCLUDE=/usr/include/lua5.1 -elif [ -d /usr/include/lua5.3 ]; then - export LUA_DIR=/usr +if [ -d /usr/local/include/lua5.3 ]; then LUA_VERSION="5.3" - LUA_INCLUDE=/usr/include/lua5.3 + LUA_INCLUDE=/usr/local/include/lua5.3 elif [ -d /usr/include/lua5.2 ]; then export LUA_DIR=/usr LUA_VERSION="5.2" LUA_INCLUDE=/usr/include/lua5.2 +elif [ -d /usr/include/lua5.1 ]; then + LUA_VERSION="5.1" + LUA_INCLUDE=/usr/include/lua5.1 elif [ -d /usr/local/include/lua5.1 ]; then export LUA_DIR=/usr/local LUA_VERSION="5.1" diff --git a/scripts/run-tests-e2.lua b/scripts/run-tests-e2.lua index f12ed0128..dd0631086 100644 --- a/scripts/run-tests-e2.lua +++ b/scripts/run-tests-e2.lua @@ -2,7 +2,10 @@ -- Tests are under scripts/test/e2 and all files must be in scripts/test/e2/init.lua lunit = require('lunit') +if _VERSION >= 'Lua 5.2' then module = lunit.module +end + path = 'scripts' if config.install then path = config.install .. '/' .. path @@ -11,7 +14,6 @@ package.path = package.path .. ';' .. path .. '/?.lua;' .. path .. '/?/init.lua' config.rules = 'e2' -lunit = require 'lunit' require 'eressea' require 'eressea.xmlconf' require 'eressea.path' diff --git a/scripts/run-tests-e3.lua b/scripts/run-tests-e3.lua index 67ae860eb..e2a808147 100644 --- a/scripts/run-tests-e3.lua +++ b/scripts/run-tests-e3.lua @@ -2,7 +2,9 @@ -- Tests are under scripts/test/e3 and all files must be in scripts/test/e3/init.lua lunit = require('lunit') +if _VERSION >= 'Lua 5.2' then module = lunit.module +end path = 'scripts' if config.install then @@ -12,7 +14,6 @@ package.path = package.path .. ';' .. path .. '/?.lua;' .. path .. '/?/init.lua' config.rules = 'e3' -lunit = require 'lunit' require 'eressea' require 'eressea.path' require 'eressea.xmlconf' diff --git a/scripts/run-tests.lua b/scripts/run-tests.lua index e81ceeede..e21ac3aa9 100644 --- a/scripts/run-tests.lua +++ b/scripts/run-tests.lua @@ -1,18 +1,19 @@ -- Basic test without loading XML Config. Test care about needed settings. -- Tests are under scripts/test/ and all files must be in scripts/test/init.lua +lunit = require('lunit') +if _VERSION >= 'Lua 5.2' then +module = lunit.module +end + path = 'scripts' if config.install then path = config.install .. '/' .. path end package.path = package.path .. ';' .. path .. '/?.lua;' .. path .. '/?/init.lua' -lunit = require 'lunit' require 'eressea' require 'eressea.path' - -lunit = require('lunit') -module = lunit.module require 'tests' result = lunit.main() return result.errors + result.failed diff --git a/scripts/tests/bindings.lua b/scripts/tests/bindings.lua index 4e308de99..bdacf2660 100644 --- a/scripts/tests/bindings.lua +++ b/scripts/tests/bindings.lua @@ -1,9 +1,9 @@ local tcname = 'tests.bindings' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end local _G = _G diff --git a/scripts/tests/common.lua b/scripts/tests/common.lua index 10084f554..058a53e2f 100644 --- a/scripts/tests/common.lua +++ b/scripts/tests/common.lua @@ -1,9 +1,9 @@ local tcname = 'tests.shared.common' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end local function _test_create_ship(r) diff --git a/scripts/tests/config.lua b/scripts/tests/config.lua index cdf93ed2c..0ea46b133 100644 --- a/scripts/tests/config.lua +++ b/scripts/tests/config.lua @@ -1,9 +1,9 @@ local tcname = 'tests.shared.config' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/e2/adamantium.lua b/scripts/tests/e2/adamantium.lua index 0a0c2ec6b..49766cb52 100644 --- a/scripts/tests/e2/adamantium.lua +++ b/scripts/tests/e2/adamantium.lua @@ -1,9 +1,9 @@ local tcname = 'tests.e2.adamantium' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/e2/allies.lua b/scripts/tests/e2/allies.lua index 52f69ba98..977d75c61 100644 --- a/scripts/tests/e2/allies.lua +++ b/scripts/tests/e2/allies.lua @@ -1,9 +1,9 @@ local tcname = 'tests.e2.allies' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/e2/astral.lua b/scripts/tests/e2/astral.lua index c183c6207..20e53cb73 100644 --- a/scripts/tests/e2/astral.lua +++ b/scripts/tests/e2/astral.lua @@ -1,9 +1,9 @@ local tcname = 'tests.e2.astral' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/e2/buildings.lua b/scripts/tests/e2/buildings.lua index 0e735f0b9..3ae9c0337 100644 --- a/scripts/tests/e2/buildings.lua +++ b/scripts/tests/e2/buildings.lua @@ -1,9 +1,9 @@ local tcname = 'tests.e2.buildings' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/e2/carts.lua b/scripts/tests/e2/carts.lua index f649451e2..f96affba7 100644 --- a/scripts/tests/e2/carts.lua +++ b/scripts/tests/e2/carts.lua @@ -1,9 +1,9 @@ local tcname = 'tests.e2.carts' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/e2/destroy.lua b/scripts/tests/e2/destroy.lua index 7a02f0840..bbdab2b0d 100644 --- a/scripts/tests/e2/destroy.lua +++ b/scripts/tests/e2/destroy.lua @@ -1,9 +1,9 @@ local tcname = 'tests.e2.destroy' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/e2/e2features.lua b/scripts/tests/e2/e2features.lua index dc083e69d..f0ee62414 100644 --- a/scripts/tests/e2/e2features.lua +++ b/scripts/tests/e2/e2features.lua @@ -1,9 +1,9 @@ local tcname = 'tests.e2.features' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/e2/guard.lua b/scripts/tests/e2/guard.lua index fd7f37ad0..0cc970f8c 100644 --- a/scripts/tests/e2/guard.lua +++ b/scripts/tests/e2/guard.lua @@ -1,9 +1,9 @@ local tcname = 'tests.e2.guard' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/e2/insects.lua b/scripts/tests/e2/insects.lua index 296c67e82..2e7fe5282 100644 --- a/scripts/tests/e2/insects.lua +++ b/scripts/tests/e2/insects.lua @@ -1,9 +1,9 @@ local tcname = 'tests.e2.insects' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/e2/items.lua b/scripts/tests/e2/items.lua index 9221d424b..ba0d305c8 100644 --- a/scripts/tests/e2/items.lua +++ b/scripts/tests/e2/items.lua @@ -1,9 +1,9 @@ local tcname = 'tests.e2.items' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/e2/movement.lua b/scripts/tests/e2/movement.lua index db9f4fbdd..d5f2f886f 100644 --- a/scripts/tests/e2/movement.lua +++ b/scripts/tests/e2/movement.lua @@ -1,9 +1,9 @@ local tcname = 'tests.e2.movement' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/e2/production.lua b/scripts/tests/e2/production.lua index 7941c1af4..092e44dd6 100644 --- a/scripts/tests/e2/production.lua +++ b/scripts/tests/e2/production.lua @@ -1,9 +1,9 @@ local tcname = 'tests.e2.production' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/e2/quit.lua b/scripts/tests/e2/quit.lua index 9d02c49eb..f1a8e6a0c 100644 --- a/scripts/tests/e2/quit.lua +++ b/scripts/tests/e2/quit.lua @@ -1,9 +1,9 @@ local tcname = 'tests.e2.quit' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end function test_quit_faction() diff --git a/scripts/tests/e2/shiplanding.lua b/scripts/tests/e2/shiplanding.lua index 7b146f2e6..f5eb9f400 100644 --- a/scripts/tests/e2/shiplanding.lua +++ b/scripts/tests/e2/shiplanding.lua @@ -1,9 +1,9 @@ local tcname = 'tests.e2.shiplanding' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/e2/ships.lua b/scripts/tests/e2/ships.lua index 2f5db607d..db44871b3 100644 --- a/scripts/tests/e2/ships.lua +++ b/scripts/tests/e2/ships.lua @@ -1,9 +1,9 @@ local tcname = 'tests.e2.ships' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/e2/spells.lua b/scripts/tests/e2/spells.lua index cf8814de2..2a5c50b2c 100644 --- a/scripts/tests/e2/spells.lua +++ b/scripts/tests/e2/spells.lua @@ -1,9 +1,9 @@ local tcname = 'tests.e2.spells' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/e2/stealth.lua b/scripts/tests/e2/stealth.lua index 60b66e83f..6a8fcd9f9 100644 --- a/scripts/tests/e2/stealth.lua +++ b/scripts/tests/e2/stealth.lua @@ -1,9 +1,9 @@ local tcname = 'tests.e2.stealth' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end local f diff --git a/scripts/tests/e2/trees.lua b/scripts/tests/e2/trees.lua index 21f7611cd..b5bfa1f6b 100644 --- a/scripts/tests/e2/trees.lua +++ b/scripts/tests/e2/trees.lua @@ -1,9 +1,9 @@ local tcname = 'tests.e2.trees' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/e2/trolls.lua b/scripts/tests/e2/trolls.lua index 811f1f736..cc60ade2d 100644 --- a/scripts/tests/e2/trolls.lua +++ b/scripts/tests/e2/trolls.lua @@ -1,9 +1,9 @@ local tcname = 'tests.e2.trolls' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/e2/undead.lua b/scripts/tests/e2/undead.lua index d43f67164..5b8170ef6 100644 --- a/scripts/tests/e2/undead.lua +++ b/scripts/tests/e2/undead.lua @@ -1,9 +1,9 @@ local tcname = 'tests.e2.undead' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/e3/buildings.lua b/scripts/tests/e3/buildings.lua index fa9f5d16f..1258f9824 100644 --- a/scripts/tests/e3/buildings.lua +++ b/scripts/tests/e3/buildings.lua @@ -1,9 +1,9 @@ local tcname = 'tests.e3.buildings' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/e3/items.lua b/scripts/tests/e3/items.lua index 1036f6ca4..60fce6b7a 100644 --- a/scripts/tests/e3/items.lua +++ b/scripts/tests/e3/items.lua @@ -1,9 +1,9 @@ local tcname = 'tests.e3.items' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/e3/morale.lua b/scripts/tests/e3/morale.lua index 898e08674..60ed55965 100644 --- a/scripts/tests/e3/morale.lua +++ b/scripts/tests/e3/morale.lua @@ -1,9 +1,9 @@ local tcname = 'tests.e3.morale' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/e3/parser.lua b/scripts/tests/e3/parser.lua index 52a082bf1..862f9d946 100644 --- a/scripts/tests/e3/parser.lua +++ b/scripts/tests/e3/parser.lua @@ -1,9 +1,9 @@ local tcname = 'tests.e3.parser' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/e3/production.lua b/scripts/tests/e3/production.lua index 1ff3e4260..9a631c755 100644 --- a/scripts/tests/e3/production.lua +++ b/scripts/tests/e3/production.lua @@ -1,9 +1,9 @@ local tcname = 'tests.e3.production' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/e3/rules.lua b/scripts/tests/e3/rules.lua index ae2766d2c..89a6d822a 100644 --- a/scripts/tests/e3/rules.lua +++ b/scripts/tests/e3/rules.lua @@ -1,9 +1,9 @@ local tcname = 'tests.e3.rules' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end local settings diff --git a/scripts/tests/e3/spells-e2.lua b/scripts/tests/e3/spells-e2.lua index 205450268..0e2ab4e6d 100644 --- a/scripts/tests/e3/spells-e2.lua +++ b/scripts/tests/e3/spells-e2.lua @@ -1,9 +1,9 @@ local tcname = 'tests.e3.e2spells' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end local r, f, u diff --git a/scripts/tests/e3/spells.lua b/scripts/tests/e3/spells.lua index 1d76bb3f1..fb68ba3d1 100644 --- a/scripts/tests/e3/spells.lua +++ b/scripts/tests/e3/spells.lua @@ -1,9 +1,9 @@ local tcname = 'tests.e3.spells' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/e3/stealth.lua b/scripts/tests/e3/stealth.lua index 0c0df3c2b..1db6436a1 100644 --- a/scripts/tests/e3/stealth.lua +++ b/scripts/tests/e3/stealth.lua @@ -1,9 +1,9 @@ local tcname = 'tests.e3.stealth' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end local f diff --git a/scripts/tests/economy.lua b/scripts/tests/economy.lua index 17dcbfc61..271d245d6 100644 --- a/scripts/tests/economy.lua +++ b/scripts/tests/economy.lua @@ -1,9 +1,9 @@ local tcname = 'tests.shared.economy' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/faction.lua b/scripts/tests/faction.lua index 7247498ea..fe728e9a0 100644 --- a/scripts/tests/faction.lua +++ b/scripts/tests/faction.lua @@ -1,8 +1,9 @@ -local lunit = require("lunit") +local tcname = 'tests.faction' +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then - _ENV = module("tests.faction", 'seeall') + _ENV = module(tcname, 'seeall') else - module("tests.faction", 'seeall') + module(tcname, lunit.testcase, package.seeall) end local f diff --git a/scripts/tests/hunger.lua b/scripts/tests/hunger.lua index fed24440e..750d7c74b 100644 --- a/scripts/tests/hunger.lua +++ b/scripts/tests/hunger.lua @@ -1,9 +1,9 @@ local tcname = 'tests.hunger' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/items.lua b/scripts/tests/items.lua index e1e780f3c..c6252db17 100644 --- a/scripts/tests/items.lua +++ b/scripts/tests/items.lua @@ -3,7 +3,7 @@ local lunit = require("lunit") if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/laws.lua b/scripts/tests/laws.lua index e22bc5d8f..d9a379319 100644 --- a/scripts/tests/laws.lua +++ b/scripts/tests/laws.lua @@ -1,8 +1,9 @@ -local lunit = require("lunit") +local tcname = 'tests.laws' +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then - _ENV = module("tests.laws", 'seeall') + _ENV = module(tcname, 'seeall') else - module("tests.laws", 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/locale.lua b/scripts/tests/locale.lua index d1d35ded3..2b4dbea8c 100644 --- a/scripts/tests/locale.lua +++ b/scripts/tests/locale.lua @@ -1,8 +1,9 @@ -local lunit = require("lunit") +local tcname = 'tests.locale' +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then - _ENV = module("tests.locale", 'seeall') + _ENV = module(tcname, 'seeall') else - module("tests.locale", 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/magicbag.lua b/scripts/tests/magicbag.lua index 7e4629707..e34d5fba5 100644 --- a/scripts/tests/magicbag.lua +++ b/scripts/tests/magicbag.lua @@ -1,9 +1,9 @@ local tcname = 'tests.shared.magicbag' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end local u diff --git a/scripts/tests/movement.lua b/scripts/tests/movement.lua index 943e912a8..16868dfec 100644 --- a/scripts/tests/movement.lua +++ b/scripts/tests/movement.lua @@ -1,8 +1,9 @@ +local tcname = 'tests.movement' local lunit = require("lunit") if _VERSION >= 'Lua 5.2' then - _ENV = module("tests.movement", 'seeall') + _ENV = module(tcname , 'seeall') else - module("tests.movement", 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/orders.lua b/scripts/tests/orders.lua index c63254315..d3ade71d2 100644 --- a/scripts/tests/orders.lua +++ b/scripts/tests/orders.lua @@ -1,9 +1,9 @@ local tcname = 'tests.shared.orders' local lunit = require("lunit") if _VERSION >= 'Lua 5.2' then - _ENV = module(tcname, 'seeall') + _ENV = module(tcname , 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end local _G = _G diff --git a/scripts/tests/parser.lua b/scripts/tests/parser.lua index 835e08d92..7cd42b17f 100644 --- a/scripts/tests/parser.lua +++ b/scripts/tests/parser.lua @@ -1,9 +1,9 @@ local tcname = 'tests.shared.parser' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/pool.lua b/scripts/tests/pool.lua index 06f212f60..398ff6fa2 100644 --- a/scripts/tests/pool.lua +++ b/scripts/tests/pool.lua @@ -1,8 +1,9 @@ -local lunit = require("lunit") +local tcname = 'tests.pool' +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then - _ENV = module("tests.pool", 'seeall') + _ENV = module(tcname, 'seeall') else - module("tests.pool", 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/process.lua b/scripts/tests/process.lua index 0b9b3e35b..b9fcf5055 100644 --- a/scripts/tests/process.lua +++ b/scripts/tests/process.lua @@ -1,9 +1,9 @@ local tcname = 'tests.shared.process' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end local u, r, f diff --git a/scripts/tests/production.lua b/scripts/tests/production.lua index b127fff02..bea8fcf33 100644 --- a/scripts/tests/production.lua +++ b/scripts/tests/production.lua @@ -1,9 +1,9 @@ local tcname = 'tests.shared.production' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/recruit.lua b/scripts/tests/recruit.lua index d783fc692..6a0cc5de6 100644 --- a/scripts/tests/recruit.lua +++ b/scripts/tests/recruit.lua @@ -1,9 +1,9 @@ local tcname = 'tests.shared.recruit' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/regions.lua b/scripts/tests/regions.lua index e16dd1691..881930a40 100644 --- a/scripts/tests/regions.lua +++ b/scripts/tests/regions.lua @@ -1,9 +1,9 @@ local tcname = 'tests.regions' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/report.lua b/scripts/tests/report.lua index 66eaa7d89..466e77e1a 100644 --- a/scripts/tests/report.lua +++ b/scripts/tests/report.lua @@ -1,9 +1,9 @@ local tcname = 'tests.shared.report' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/settings.lua b/scripts/tests/settings.lua index f321a515b..ec4cac2d1 100644 --- a/scripts/tests/settings.lua +++ b/scripts/tests/settings.lua @@ -1,9 +1,9 @@ local tcname = 'tests.settings' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/spells.lua b/scripts/tests/spells.lua index 767df5d16..b0def9560 100644 --- a/scripts/tests/spells.lua +++ b/scripts/tests/spells.lua @@ -1,9 +1,9 @@ local tcname = 'tests.shared.spells' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/storage.lua b/scripts/tests/storage.lua index 22af5a221..d51912694 100644 --- a/scripts/tests/storage.lua +++ b/scripts/tests/storage.lua @@ -1,9 +1,9 @@ local tcname = 'tests.shared.storage' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/study.lua b/scripts/tests/study.lua index 21c70044e..51065b12a 100644 --- a/scripts/tests/study.lua +++ b/scripts/tests/study.lua @@ -1,9 +1,9 @@ local tcname = 'tests.study' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/undead.lua b/scripts/tests/undead.lua index 4cb86fc67..43d910c9f 100644 --- a/scripts/tests/undead.lua +++ b/scripts/tests/undead.lua @@ -1,9 +1,9 @@ local tcname = 'tests.shared.undead' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/scripts/tests/xmas.lua b/scripts/tests/xmas.lua index 10386c0ed..58400aa9f 100644 --- a/scripts/tests/xmas.lua +++ b/scripts/tests/xmas.lua @@ -1,9 +1,9 @@ local tcname = 'tests.shared.xmas' -local lunit = require("lunit") +local lunit = require('lunit') if _VERSION >= 'Lua 5.2' then _ENV = module(tcname, 'seeall') else - module(tcname, 'seeall') + module(tcname, lunit.testcase, package.seeall) end function setup() diff --git a/src/laws.c b/src/laws.c index fc1c8dc88..01aa4be8d 100644 --- a/src/laws.c +++ b/src/laws.c @@ -684,7 +684,7 @@ growing_trees(region * r, const season_t current_season, const season_t last_wee a->data.sa[0] = (short)cap_int(rtrees(r, 0), 0, SHRT_MAX); a->data.sa[1] = (short)cap_int(rtrees(r, 1), 0, SHRT_MAX); } - else if (a->data.sa[0] < 0 || a->data.sa[1] << 0) { + else if (a->data.sa[0] < 0 || a->data.sa[1] < 0) { a->data.sa[0] = (short)cap_int(a->data.sa[0], 0, SHRT_MAX); a->data.sa[1] = (short)cap_int(a->data.sa[1], 0, SHRT_MAX); }