3 # This file is part of lunit 0.5.
5 # For Details about lunit look at: http://www.mroth.net/lunit/
7 # Author: Michael Roth <mroth@nessie.de>
9 # Copyright (c) 2004-2009 Michael Roth <mroth@nessie.de>
11 # Permission is hereby granted, free of charge, to any person
12 # obtaining a copy of this software and associated documentation
13 # files (the "Software"), to deal in the Software without restriction,
14 # including without limitation the rights to use, copy, modify, merge,
15 # publish, distribute, sublicense, and/or sell copies of the Software,
16 # and to permit persons to whom the Software is furnished to do so,
17 # subject to the following conditions:
19 # The above copyright notice and this permission notice shall be
20 # included in all copies or substantial portions of the Software.
22 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25 # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
26 # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
27 # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
28 # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32 echo "$0: Usage Error. Try $0 --help" >&2
36 if [ `uname` = "Darwin" ]; then
37 scriptname
="$(readlink -n "$0")"
39 scriptname
="$(readlink -n -f "$0")"
49 Copyright (c) 2004-2009 Michael Roth <mroth@nessie.de>
50 This program comes WITHOUT WARRANTY OF ANY KIND.
52 Usage: lunit [OPTIONS] [--] scripts
56 -i, --interpreter LUA Complete path of the lua binary to use.
57 -p, --path PATH Sets the LUA_PATH environment for the tests.
58 --cpath CPATH Sets the LUA_CPATH environment for the tests.
59 -r, --runner RUNNER Testrunner to use, defaults to 'lunit-console'.
60 -t, --test PATTERN Which tests to run, may contain * or ? wildcards.
61 --loadonly Only load the tests.
62 --dontforce Do not force to load $scriptname*.lua.
63 -h, --help Print this help screen.
64 --version Print lunit version.
66 Please report bugs to <mroth@nessie.de>.
71 echo "lunit 0.5 Copyright 2004-2009 Michael Roth <mroth@nessie.de>"
96 -r|
--runner|
-t|
--test)
97 options
="$options $1 $2"
104 echo "$0: Invalid option: $1" >&2
113 exec "$interpreter" - "$scriptname" $options "$@" <<EOT
114 local scriptname = ...
115 local argv = { select(2,...) }
116 if scriptname ~= "" then
117 local function force(name)
118 pcall( function() loadfile(name)() end )
120 force( scriptname..".lua" )
121 force( scriptname.."-console.lua" )
124 local stats = lunit.main(argv)
125 if stats.errors > 0 or stats.failed > 0 then