|
@@ -7,18 +7,28 @@ end
|
|
|
|
|
|
if arg[1] then
|
|
|
arg[1] = arg[1]:gsub('^(tests/).+', ''):gsub('%.lua$', '')
|
|
|
- return dofile('tests/' .. arg[1] .. '.lua')
|
|
|
+ dofile('tests/' .. arg[1] .. '.lua')
|
|
|
+else
|
|
|
+ local files = {
|
|
|
+ 'observer'
|
|
|
+ }
|
|
|
+
|
|
|
+ for i, file in ipairs(files) do
|
|
|
+ dofile('tests/' .. file .. '.lua')
|
|
|
+ if next(files, i) then
|
|
|
+ print()
|
|
|
+ end
|
|
|
+ end
|
|
|
end
|
|
|
|
|
|
-local files = {
|
|
|
- 'observer'
|
|
|
-}
|
|
|
+local red = string.char(27) .. '[31m'
|
|
|
+local green = string.char(27) .. '[32m'
|
|
|
+local normal = string.char(27) .. '[0m'
|
|
|
|
|
|
-for i, file in ipairs(files) do
|
|
|
- dofile('tests/' .. file .. '.lua')
|
|
|
- if next(files, i) then
|
|
|
- print()
|
|
|
- end
|
|
|
+if lust.errors > 0 then
|
|
|
+ io.write(red .. lust.errors .. normal .. ' failed, ')
|
|
|
end
|
|
|
|
|
|
+print(green .. lust.passes .. normal .. ' passed')
|
|
|
+
|
|
|
if lust.errors > 0 then os.exit(1) end
|