From b69ae350d2e9eced9545ec8367cc45c951495edd Mon Sep 17 00:00:00 2001 From: Etiene Dalcol Date: Sun, 24 Jan 2016 09:32:35 +0100 Subject: Update test to exit on error code in case tests fail --- valua-test.lua | 6 ++++++ 1 file changed, 6 insertions(+) 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 -- cgit v1.2.3-54-g00ecf