Skip to content

vorgestern/ulutest

Repository files navigation

ulutest

Ulutest is a unittest framework for Lua, which produces output very similar to the output of googletest.

It can be used to test modules for lua (written in Lua or C).

Writing a test requires minimal information beyond what to test and what result to expect. Ulutest produces output that is easy to read and easy to interpret from the formulation of the test itself. Therefore it is easy to write robust tests with minimal effort.

alt text

This output was produced with demo_simple.lua, essentially ..

... load system under test and ulutest ...
ulu.RUN {
    {
        name="function demo1",
        tt("exists", function(t)
            t:ASSERT_EQ("function", type(demo1))
        end),
        tt("string,string", function(t)
            t:ASSERT_EQ("(abc,xyz)", demo1("abc","xyz"))
        end)
    },
    {
        name="function demo2",
        tt("exists", function(t)
            -- t:ASSERT_EQ("function", type(demo2))
        end)
    },
    {
        name="function demo3",
        tt("exists", function(t)
            t:EXPECT_EQ("function", type(demo3), "wrong type:")
        end)
    }
}

How to build ..

.. either on Windows

Location of Lua: Edit buildsys/VS17/Lua.props to match your Lua-installation.
Output module on LUA_CPATH: Optionally define a local installation directory by supplying LocalInstall.props. (No such file is supplied by default. Use https://github.com/vorgestern/vsprops/LocalInstall_LuaModules.props as a starting point.)

Open buildsys/VS17/ulutest.sln and proceed as always.

.. or else on Linux

Use ./Makefile. Lua 5.4 is expected in /usr/include/lua5.4.

To do ...

... still ..

  • Account for the difference in the bottom line if tests have been skipped.
  • Introduce setup and teardown on a per test basis.
  • Allow listing and filtering tests.

... no more

  • Make ulutest process a list of tests rather than a random number of test arguments.

About

Unittest framework for Lua

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published