Sun, 21 Jun 2009 23:19:56 +0100
tests: Add support for checking the consumed part of the input
tests.lua | file | annotate | diff | comparison | revisions |
--- a/tests.lua Sun Jun 21 23:12:23 2009 +0100 +++ b/tests.lua Sun Jun 21 23:19:56 2009 +0100 @@ -6,12 +6,16 @@ local all_ok = true; -local function check(input, output) - local ret = when(input, 0); +local function check(input, output, e_start, e_finish) + local ret, start, finish = when(input, 0); if ret ~= output then print("FAIL: "..input.." [produces "..ret.."/"..os.date("!%c", ret).."]"); all_ok = false; return false; + elseif (e_start and e_finish) and (start ~= e_start or finish ~= e_finish) then + print("FAIL: "..input.." [uses "..start..","..finish.." instead of "..e_start..","..e_finish.."]"); + all_ok = false; + return false; end end