From 10d0bd315fe750f92fc7d7efd6fb0e01907cbc06 Mon Sep 17 00:00:00 2001 From: Jason Perkins Date: Wed, 23 Jul 2014 13:10:41 -0400 Subject: [PATCH] Small fixes to unit test framework - test.contains() can now accept and array of values to check - no longer errors on /test argument if no matching suite/test is found --- tests/testfx.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/testfx.lua b/tests/testfx.lua index 76fc48de..c9962f68 100644 --- a/tests/testfx.lua +++ b/tests/testfx.lua @@ -65,9 +65,13 @@ end - function test.contains(value, actual) - if not table.contains(actual, value) then - test.fail("expected value %s not found", value) + function test.contains(expected, actual) + if type(expected) == "table" then + for i, v in ipairs(expected) do + test.contains(v, actual) + end + elseif not table.contains(actual, expected) then + test.fail("expected value %s not found", expected) end end @@ -409,7 +413,7 @@ function runsuite(suitename, suitetests, testname) if testname then runtest(suitename, suitetests, testname, suitetests[testname]) - else + elseif suitetests then for testname, testfunc in pairs(suitetests) do runtest(suitename, suitetests, testname, testfunc) end