summaryrefslogtreecommitdiffstats
path: root/test/lua/tests.lua
diff options
context:
space:
mode:
authorMikhail Galanin <mgalanin@mimecast.com>2018-09-20 11:26:36 +0100
committerMikhail Galanin <mgalanin@mimecast.com>2018-09-20 11:26:36 +0100
commit99b68e8e51215eab50d33b5af0e0e12b1b497e1e (patch)
tree0ac06164c3382ad931478451a1a9b8b5ce34398f /test/lua/tests.lua
parentd82bb62834c158a2108ceb412745b046b2990b9f (diff)
downloadrspamd-99b68e8e51215eab50d33b5af0e0e12b1b497e1e.tar.gz
rspamd-99b68e8e51215eab50d33b5af0e0e12b1b497e1e.zip
[Test] Pass test-case patten into test engine
So that now we can set which test cases should be runned: $ ./test/rspamd-test -p /rspamd/lua -t selectors.lua -c "case .* rcpts" $ ./test/rspamd-test -p /rspamd/lua -c "case 1st rcpts" -c accepts Lua-pattern
Diffstat (limited to 'test/lua/tests.lua')
-rw-r--r--test/lua/tests.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/test/lua/tests.lua b/test/lua/tests.lua
index 99d509de0..6c05e02e0 100644
--- a/test/lua/tests.lua
+++ b/test/lua/tests.lua
@@ -8,8 +8,14 @@ local contexts = {}
for _,t in ipairs(tests_list) do
telescope.load_contexts(t, contexts)
end
+local function test_filter(test)
+ return test.name:match(test_pattern)
+end
+if not test_pattern then
+ test_filter = function(_) return true end
+end
local buffer = {}
-local results = telescope.run(contexts, callbacks, test_pattern)
+local results = telescope.run(contexts, callbacks, test_filter)
local summary, data = telescope.summary_report(contexts, results)
table.insert(buffer, telescope.test_report(contexts, results))