aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEtiene Dalcol <dalcol@etiene.net>2016-01-24 09:32:35 +0100
committerEtiene Dalcol <dalcol@etiene.net>2016-01-24 09:32:35 +0100
commitb69ae350d2e9eced9545ec8367cc45c951495edd (patch)
treea9bbb2402d07198ef3e784abcd4c5dbf311947ca
parent41523211bf2148dd7cb3ff745584fccc1233dc1b (diff)
downloadvalua-b69ae350d2e9eced9545ec8367cc45c951495edd.tar.gz
valua-b69ae350d2e9eced9545ec8367cc45c951495edd.tar.bz2
valua-b69ae350d2e9eced9545ec8367cc45c951495edd.zip
Update test to exit on error code in case tests fail
-rw-r--r--valua-test.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/valua-test.lua b/valua-test.lua
index 35dc247..4554382 100644
--- a/valua-test.lua
+++ b/valua-test.lua
@@ -1,4 +1,5 @@
local v = require "valua"
+local passing = true
local function check(val_test, test_value, expected, n)
local res,err = val_test(test_value)
@@ -7,6 +8,7 @@ local function check(val_test, test_value, expected, n)
if res == expected then
msg = msg.. "succeeded"
else
+ passing = false
msg = msg.. " \27[31m FAILED \27[0m"
end
msg = msg.." on '"..(tostring(test_value)).."'. Expected: "..tostring(expected)..", result: "..tostring(res)..". "
@@ -64,4 +66,8 @@ for n,t in ipairs(tests) do
for i = 1, #t[2], 2 do
check(t[1],test_values[t[2][i]],t[2][i+1],n)
end
+end
+
+if not passing then
+ error('Tests are failing')
end \ No newline at end of file