bluebird75 / luaunit

LuaUnit is a popular unit-testing framework for Lua, with an interface typical of xUnit libraries (Python unittest, Junit, NUnit, ...). It supports several output formats (Text, TAP, JUnit, ...) to be used directly or work with Continuous Integration platforms (Jenkins, Maven, ...).
Other
565 stars 136 forks source link

Add method prefix and test prefix/suffix options. #155

Open obszczymucha opened 1 year ago

obszczymucha commented 1 year ago

This allows specifying the prefix for test and method names, so the tests can be now defined as follows:

function shouldValidateArguments()
...
end

or

function should_validate_arguments()
...
end

If not provided, the behavior is unchanged and it defaults to the current test prefix.

Runner example:

local runner = lu.LuaUnit.new()
runner:setOutputType( "text" )
os.exit( runner:runSuite( "-t", "should" ) )

Or we can do this with objects:

MySpecification = {}

function MySpecification:shouldAddTwoNumbers()
...
end

Runner example:

local runner = lu.LuaUnit.new()
runner:setOutputType( "text" )
os.exit( runner:runSuite( "-T", "Specification", "-m", "should" ) )
bluebird75 commented 1 year ago

Hi,

Sorry for the delay, I just moved to a new house so things like open source have been left behind.

I like the patch, I need to further review it but it looks great. And with unit-tests, this is exceptional 👍

obszczymucha commented 1 year ago

Hey. No worries at all! Thanks for responding!