Skip to content

Commit

Permalink
Fixes:
Browse files Browse the repository at this point in the history
- add setVerbosity() to control verbosity manually
- include test functions starting with "test" when discovering tests
  • Loading branch information
Bluebird75 committed Oct 29, 2012
1 parent b2ecf9b commit fbb6f30
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
9 changes: 7 additions & 2 deletions example_with_luaunit.lua
Expand Up @@ -94,6 +94,11 @@ end
-- LuaUnit:run( 'TestFunctions:test1_withFailure' ) -- LuaUnit:run( 'TestFunctions:test1_withFailure' )
-- LuaUnit:run( 'TestToto' ) -- run only on test class -- LuaUnit:run( 'TestToto' ) -- run only on test class
-- LuaUnit:run( 'TestTiti:test3') -- run only one test method of a test class -- LuaUnit:run( 'TestTiti:test3') -- run only one test method of a test class
-- lu = LuaUnit -- LuaUnit:run() -- run everything

---- Control test output:
lu = LuaUnit
-- lu:setOutputType( "NIL" )
-- lu:setOutputType( "TAP" ) -- lu:setOutputType( "TAP" )
-- lu:run() lu:setVerbosity( 0 )
lu:run()
6 changes: 5 additions & 1 deletion luaunit.lua
Expand Up @@ -409,6 +409,10 @@ LuaUnit_MT = { __index = LuaUnit }
error( 'No such format: '..outputType) error( 'No such format: '..outputType)
end end


function LuaUnit:setVerbosity( verbosity )
self.verbosity = verbosity
end

--------------[[ Runner ]]----------------- --------------[[ Runner ]]-----------------


SPLITTER = '\n>----------<\n' SPLITTER = '\n>----------<\n'
Expand Down Expand Up @@ -580,7 +584,7 @@ LuaUnit_MT = { __index = LuaUnit }
-- not iterate over _G while modifying it. -- not iterate over _G while modifying it.
args = {} args = {}
for key, val in pairs(_G) do for key, val in pairs(_G) do
if string.sub(key,1,4) == 'Test' then if string.sub(key,1,4):lower() == 'test' then
table.insert( args, key ) table.insert( args, key )
end end
end end
Expand Down

0 comments on commit fbb6f30

Please sign in to comment.