diff options
author | Mikhail Galanin <mgalanin@mimecast.com> | 2018-09-20 11:26:36 +0100 |
---|---|---|
committer | Mikhail Galanin <mgalanin@mimecast.com> | 2018-09-20 11:26:36 +0100 |
commit | 99b68e8e51215eab50d33b5af0e0e12b1b497e1e (patch) | |
tree | 0ac06164c3382ad931478451a1a9b8b5ce34398f /test/lua/tests.lua | |
parent | d82bb62834c158a2108ceb412745b046b2990b9f (diff) | |
download | rspamd-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.lua | 8 |
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)) |