Put newbie info about lua tests here.
Please write your observations about not obvious things when playing with lua tests.
How to run lua tests
One must build tester
make tester # on unix
make tester.exe
NOTE if you invoke make tester
on mingw make will try to build tester using implicit make rules and will fail miserably. That's the reason for giving .exe suffix.
To run the tests invoke following command:
./tester ./tester lua-testsuite.lua [tests ...]
Testsuite invoked without any test names invoke all tests.
How to build lua tests
This is basic unittesting stuff. Interesting functions:
function name | description |
---|---|
check( condition: boolean) |
fails when condition is not met |
qgrep( pattern: string, filename: string) |
returns true if pattern is found in given file |
check( mtn(args ...), expected_return_value,catch_stdout, catch_stderr) |
idiom: invoke monotone with given args, check return status and possibly remember its standard and diagnostic output |
get(filename) |
read contents of file and return string |
mkdir(name) |
create directory |
addfile(name, contents) |
idiom for writefile(name, contents) , mtn add name |