aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xtest.lua5
-rw-r--r--test/init.lua18
2 files changed, 15 insertions, 8 deletions
diff --git a/test.lua b/test.lua
index e02345f..a61ed86 100755
--- a/test.lua
+++ b/test.lua
@@ -1,7 +1,6 @@
-#!/usr/bin/env lem
+#!/usr/bin/env lua
-package.path = './?/init.lua;'..package.path..';./lua/?.lua;./lua/?/init.lua;./?.lua'
-package.cpath = package.cpath..';./lua/?.so'
+package.path = './?/init.lua;./lua/?.lua;./lua/?/init.lua;./?.lua;'..package.path
local test = require 'test'
diff --git a/test/init.lua b/test/init.lua
index 0a4e05b..97f94ac 100644
--- a/test/init.lua
+++ b/test/init.lua
@@ -1,6 +1,7 @@
-local utils = require 'lem.utils'
+--local utils = require 'lem.utils'
-local updatenow = utils.updatenow
+--local updatenow = utils.updatenow
+local function updatenow() return nil end
local pack = table.pack
local unpack = table.unpack
local format = string.format
@@ -75,7 +76,9 @@ function test:run()
t1 = updatenow()
local ret, msg = xpcall(tester, msg_handler, self)
t2 = updatenow()
- self.runtime = t2 - t1
+ if t1 then
+ self.runtime = t2 - t1
+ end
self:leave()
if not ret then
self.error_msg = msg
@@ -125,8 +128,13 @@ function test:stats()
end
local run, passed, asserts = master.run, master.passed, master.assert_cnt
if run == passed then
- print(format('%d/%d All tests passed, %d assertions in %.3fs',
- run, passed, asserts, master.test.runtime))
+ local runtime = master.test.runtime
+ local runtimestr = ''
+ if runtime then
+ runtimestr = format(' in %.3fs', runtime)
+ end
+ print(format('%d/%d All tests passed, %d assertions%s',
+ run, passed, asserts, runtimestr))
else
print(format('%d/%d %d failed', run, passed, run-passed))
end