With version 2.0rc5, Busted started cleaning up between tests more thoroughly.
The result was that it managed to unload and reload lgi. However, the C part of
lgi is not safe to be reloaded. This caused sporadic errors in the test suite
runs.
Work around this via a helper script that is run before Busted starts running
tests. When we load lgi in this helper script, it is loaded before Busted starts
saving and restoring everything and thus lgi won't ever be unloaded.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Connecting to a signal weakly has the same effect as connecting to it strongly,
but it allows the garbage collector to disconnect the signal in case nothing
else references this function.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Busted now only provides the magic modules `assert`, `spy` etc for
the busted context. The helper module `spec/wibox/test_utils.lua`
therefore needs to explicitly require them.
Ref: https://github.com/awesomeWM/awesome/pull/139
This gets rid of awful.util.unittest and instead creates an automatic test for
it under spec/awful/util_spec.lua. In the process, it also fixes the test to
actually test the right thing and I took the liberty to add some more tests.
Signed-off-by: Uli Schlachter <psychon@znc.in>
The previous code assumed that pairs() iterates over the table in a specific
order which is not a safe assumption.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This uses busted (http://olivinelabs.com/busted/) to implement unit testing.
This is wired up to "make check" and/or "make test".
This commit also adds tests for the more complicated parts of the gears and
wibox.layout libraries.
Signed-off-by: Uli Schlachter <psychon@znc.in>