Skip to content

Commit

Permalink
Add --runcmd='x' option to test runner
Browse files Browse the repository at this point in the history
  • Loading branch information
ladc committed Feb 27, 2016
1 parent 765714f commit 14bfa87
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ local tagpat_exc = "^%-([_%a][_%w]*)$"
local paths, tags_inc, tags_exc = {}, {}, {}
local verbose = false
local arg = arg or {...}

local runcmd
local function print_help()
io.write[[
Usage: luajit test.lua path1 path2 +tagtofilter +orthistag -tagtoexclude -andthistag
Expand All @@ -15,6 +15,9 @@ Options:
-tag_exc Exclude tests with tag tag_exc.
--help Print this help message.
--verbose Explicitly list all tests.
--runcmd='cmd'
If runcmd is defined, Command to run the tests with, externally, e.g.
--runcmd="luajit -joff"
]]
end

Expand All @@ -30,6 +33,8 @@ for _,a in ipairs(arg) do
elseif a:match("%-%-help") then
print_help()
return
elseif a:match("%-%-runcmd") then
runcmd = a:match("%-%-runcmd=(.*)")
end
end

Expand All @@ -45,7 +50,7 @@ iowrite("\n")

local index = t.index(paths)
index = t.filter(index,tags_inc,tags_exc)
local pass, fail, failed_tests, errors = t.run(index,verbose)
local pass, fail, failed_tests, errors = t.run(index,verbose,runcmd)

iowrite("Passed ",pass,"/",pass+fail," tests.\n")
if fail==0 then return end
Expand Down

0 comments on commit 14bfa87

Please sign in to comment.