aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/common.lua10
-rw-r--r--spec/test2_spec.lua4
2 files changed, 8 insertions, 6 deletions
diff --git a/spec/common.lua b/spec/common.lua
index 4df1a7c..f1eee04 100644
--- a/spec/common.lua
+++ b/spec/common.lua
@@ -10,9 +10,9 @@ else -- windows
end
function common.rungame()
- f = io.popen(game_bin .. " spec/headless","r")
- d = f:read("*all")
- f:close()
+ f = assert(io.popen(game_bin .. " spec/headless","r"))
+ d = assert(f:read("*all"))
+ assert(f:close())
--print(d)
return d
end
@@ -21,8 +21,8 @@ function common.runboth()
--print("Running both")
--Do we have a race condition here? (Can client start and send it's message
--before the server is ready to accept?
- f1 = io.popen(server_bin .. " spec/server","r")
- f2 = io.popen(game_bin .. " spec/headless","r")
+ f1 = assert(io.popen(server_bin .. " spec/server","r"))
+ f2 = assert(io.popen(game_bin .. " spec/headless","r"))
--print("Both ran...")
d1 = f1:read("*all")
d2 = f2:read("*all")
diff --git a/spec/test2_spec.lua b/spec/test2_spec.lua
index 82ca33e..575e1d1 100644
--- a/spec/test2_spec.lua
+++ b/spec/test2_spec.lua
@@ -77,14 +77,16 @@ describe("network library",function()
end)
end
local i = os.time()
+ local game_exit = GAME.exit
function GAME.tick()
if has_ponged then
- GAME.exit()
+ game_exit()
end
if i - os.time() > 5 then
error("Failed")
end
end
+ GAME.exit = function(...) end -- only exit when we pong, not before.
]])
common.writegame([[
local socket = net.newsocket(net.PAIR)