Fix lunit not honoring "-t"
Signed-off-by: Rahix <rahix@rahix.de>
This commit is contained in:
parent
3b290e6853
commit
62658906d8
1 changed files with 15 additions and 3 deletions
16
lunit.lua
16
lunit.lua
|
|
@ -531,15 +531,27 @@ traceback_hide(runtest)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function lunit.run()
|
function lunit.run(patterns)
|
||||||
clearstats()
|
clearstats()
|
||||||
report("begin")
|
report("begin")
|
||||||
for testcasename in lunit.testcases() do
|
for testcasename in lunit.testcases() do
|
||||||
-- Run tests in the testcases
|
-- Run tests in the testcases
|
||||||
for testname in lunit.tests(testcasename) do
|
for testname in lunit.tests(testcasename) do
|
||||||
|
local run = true
|
||||||
|
if patterns ~= nil then
|
||||||
|
run = false
|
||||||
|
for _, pat in ipairs(patterns) do
|
||||||
|
if string.match(testname, pat) ~= nil then
|
||||||
|
run = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if run then
|
||||||
runtest(testcasename, testname)
|
runtest(testcasename, testname)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
report("done")
|
report("done")
|
||||||
return stats
|
return stats
|
||||||
end
|
end
|
||||||
|
|
@ -647,7 +659,7 @@ function main(argv)
|
||||||
local optname = arg; i = i + 1; arg = argv[i]
|
local optname = arg; i = i + 1; arg = argv[i]
|
||||||
checkarg(optname, arg)
|
checkarg(optname, arg)
|
||||||
testpatterns = testpatterns or {}
|
testpatterns = testpatterns or {}
|
||||||
testpatterns[#testpatterns+1] = arg
|
testpatterns[#testpatterns+1] = lunitpat2luapat(arg)
|
||||||
elseif arg == "--" then
|
elseif arg == "--" then
|
||||||
while i < #argv do
|
while i < #argv do
|
||||||
i = i + 1; arg = argv[i]
|
i = i + 1; arg = argv[i]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue