luaunit icon indicating copy to clipboard operation
luaunit copied to clipboard

Add method prefix and test prefix/suffix options.

Open obszczymucha opened this issue 2 years ago • 2 comments

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" ) )

obszczymucha avatar Jan 02 '23 06:01 obszczymucha

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 👍

bluebird75 avatar Feb 06 '23 09:02 bluebird75

Hey. No worries at all! Thanks for responding!

obszczymucha avatar Feb 06 '23 10:02 obszczymucha