[ANN] LuaUnit v3.3

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[ANN] LuaUnit v3.3

Philippe Fremy
Dear lua list,

I am happy to announce the release of LuaUnit v3.3 . The v3.2 release
saw 245k download on lua rocks, I hope this release will please our
users equally :-) .

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

This version can be downloaded with LuaRocks or from the GitHub project
page ( https://github.com/bluebird75/luaunit ). Beware that to install
with LuaRocks, you will need the version 2.4.4 released a few days ago
(due to GitHub requiring a more recent wget).

My favourite update of this release is smart list difference analysis :

    -- lua test code. Can you spot the difference ?
    function TestListCompare:test1()
        local A = { 121221, 122211, 121221, 122211, 121221, 122212,
121212, 122112, 122121, 121212, 122121 }
        local B = { 121221, 122211, 121221, 122211, 121221, 122212,
121212, 122112, 121221, 121212, 122121 }
        lu.assertEquals( A, B )

    $ lua test_some_lists_comparison.lua

    TestListCompare.test1 ... FAIL

    List difference analysis:
    * lists A (actual) and B (expected) have the same size
    * lists A and B start differing at index 9
    * lists A and B are equal again from index 10
    * Common parts:
      = A[1], B[1]: 121221
      = A[2], B[2]: 122211
      = A[3], B[3]: 121221
      = A[4], B[4]: 122211
      = A[5], B[5]: 121221
      = A[6], B[6]: 122212
      = A[7], B[7]: 121212
      = A[8], B[8]: 122112
    * Differing parts:
      - A[9]: 122121
      + B[9]: 121221
    * Common parts at the end of the lists
      = A[10], B[10]: 121212
      = A[11], B[11]: 122121

The other changes are :

- General
  * when comparing lists with assertEquals(), failure message provides
an advanced comparison of the lists
  * assertErrorMsgEquals() can check for error raised as tables
  * tests may be finished early with fail(), failIf(), success() or
  * improve printing of recursive tables
  * improvements and fixes to JUnit and TAP output
  * stricter assertTrue() and assertFalse(): they only succeed with
boolean values
  * add assertEvalToTrue() and assertEvalToFalse() with previous
assertTrue()/assertFalse() behavior of coercing to boolean before asserting
  * all assertion functions accept an optional extra message, to be
printed along the failure

-  New command-line arguments:
  * can now shuffle tests with --shuffle or -s
  * possibility to repeat tests (for example to trigger a JIT), with
--repeat NUM or -r NUM
  * more flexible test selection with inclusion (--pattern / -p) or
exclusion (--exclude / -x) or combination of both

- Scientific computing dedicated support (see documentation):
  * provide the machine epsilon in lu.EPS
  * new functions: assertNan(), assertInf(), assertPlusInf(),
assertMinusInf(), assertPlusZero(), assertMinusZero()
  * in assertAlmostEquals( a, b, margin ), margin no longer provides a
default value of 1E-11, the machine epsilon is used instead

- Platform and continuous integration support:
  * validate LuaUnit on MacOs platform (thank to Travis CI)
  * validate LuaUnit with 32 bits numbers (floats) and 64 bits numbers
  * add test coverage measurements thank to coveralls.io . Status:
99.76% of the code is verified.
  * use cache for AppVeyor and Travis builds
  * support for luarocks doc command

- General doc improvements (detailed description of all output, more
cross-linking between sections)