aboutsummaryrefslogtreecommitdiff
path: root/spec/test1_spec.lua
diff options
context:
space:
mode:
authorAlexander Pickering <alex@cogarr.net>2019-07-08 18:45:30 -0400
committerAlexander Pickering <alex@cogarr.net>2019-07-08 18:45:30 -0400
commitff704e4ca477892d97a6f23953e99ec13623e114 (patch)
tree86e88594ac204ed5acfd45758005e25e7525dc9d /spec/test1_spec.lua
parentd0cbfe54aff745bad33a2415f771dd548f6c8187 (diff)
downloadbrokengine-ff704e4ca477892d97a6f23953e99ec13623e114.tar.gz
brokengine-ff704e4ca477892d97a6f23953e99ec13623e114.tar.bz2
brokengine-ff704e4ca477892d97a6f23953e99ec13623e114.zip
Unit tests are now platform independent
Unit tests will use the .exe when on windows, and the binary without extension on linux.
Diffstat (limited to 'spec/test1_spec.lua')
-rw-r--r--spec/test1_spec.lua11
1 files changed, 9 insertions, 2 deletions
diff --git a/spec/test1_spec.lua b/spec/test1_spec.lua
index 9844204..9248b11 100644
--- a/spec/test1_spec.lua
+++ b/spec/test1_spec.lua
@@ -1,14 +1,21 @@
print("Hello, world!")
+local game_bin = nil
+if package.config:sub(1,1) == "/" then -- linux or osx
+ game_bin = "bin/client/bin/brokengine_client"
+else
+ game_bin = "bin\\client\\bin\\brokengine_client.exe"
+end
+
function rungame()
- f = io.popen("bin\\client\\bin\\brokengine_client.exe spec/headless","r")
+ f = io.popen(game_bin .. " spec/headless","r")
d = f:read("*all")
f:close()
return d
end
function writegame(...)
- f = io.open("spec/headless/init.lua","w")
+ f = assert(io.open("spec/headless/init.lua","w"))
data = {"GAME.crashy()"}
for _,v in pairs({...}) do
data[#data + 1] = v