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 GLOBAL_TESTS option #123

Closed printercu closed 5 years ago

printercu commented 5 years ago

To be able to define test outside of global namespace

Hi!

With this patch it's possible to define tests and groups outside of global namespace.

local lu = require('luaunit')
local t = lu.group('SomeFeauture')

t.setup = function()....
t.testSmth = function() ...

It's a good practice to not introduce unnecessary global variables and luacheck warns on this by default.

coveralls commented 5 years ago

Coverage Status

Coverage decreased (-0.3%) to 99.218% when pulling d6d88531c7c784cfcd2419b943e41aa359ce3280 on printercu:patch-1 into d87a5c0b213f842aead71cfd87e33233fcf59760 on bluebird75:master.

bluebird75 commented 5 years ago

I was planning to be able to define tests to run as a list at some point. I am not sure that I want to replace a full global namespace with a module global. I would much rather have a list of tests which we can pass around and use.

Do you think you could work on another prototype along the lines of what I propose ?

printercu commented 5 years ago

Can you please provide a sample use case?