mirror of
https://github.com/neovim/neovim.git
synced 2026-05-23 21:30:11 +00:00
fix(test): support multiple --filter-out #39885
fixes regression introduced in commit 55f9c2136e (test: replace busted
with local harness)
This commit is contained in:
@@ -819,6 +819,37 @@ describe('test harness', function()
|
||||
not_matches('skipped suite works', output, true)
|
||||
end)
|
||||
|
||||
it('filters tests out by multiple repeated option values', function()
|
||||
local suite_dir = write_suite({
|
||||
['one_spec.lua'] = [[
|
||||
describe('chosen suite', function()
|
||||
it('works', function() end)
|
||||
end)
|
||||
]],
|
||||
['two_spec.lua'] = [[
|
||||
describe('skipped suite', function()
|
||||
it('works', function() end)
|
||||
end)
|
||||
]],
|
||||
['three_spec.lua'] = [[
|
||||
describe('three', function()
|
||||
it('skipped test', function() end)
|
||||
end)
|
||||
]],
|
||||
})
|
||||
|
||||
local code, output = run_harness(suite_dir, {
|
||||
'--filter-out=skipped suite',
|
||||
'--filter-out=skipped test',
|
||||
})
|
||||
|
||||
eq(0, code)
|
||||
matches('1 test from 1 test file of ' .. suite_dir .. ' ran.', output, true)
|
||||
matches('chosen suite works', output, true)
|
||||
not_matches('skipped suite works', output, true)
|
||||
not_matches('three skipped test', output, true)
|
||||
end)
|
||||
|
||||
it('reports when filters exclude all tests', function()
|
||||
local suite_dir = write_suite({
|
||||
['one_spec.lua'] = [[
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
--- @field helper? string
|
||||
--- @field tags string[]
|
||||
--- @field filter? string
|
||||
--- @field filter_out? string
|
||||
--- @field filter_out string[]
|
||||
--- @field lpaths string[]
|
||||
--- @field cpaths string[]
|
||||
--- @field paths string[]
|
||||
@@ -796,8 +796,10 @@ local function test_selected(test, opts)
|
||||
return false
|
||||
end
|
||||
|
||||
if opts.filter_out and test.full_name:match(opts.filter_out) then
|
||||
return false
|
||||
for _, filter_out in ipairs(opts.filter_out) do
|
||||
if test.full_name:match(filter_out) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
@@ -1166,6 +1168,7 @@ local function parse_args(argv)
|
||||
repeat_count = 1,
|
||||
summary_file = '-',
|
||||
tags = {},
|
||||
filter_out = {},
|
||||
lpaths = {},
|
||||
cpaths = {},
|
||||
paths = {},
|
||||
@@ -1308,7 +1311,7 @@ local function parse_args(argv)
|
||||
opts.filter = pattern
|
||||
end),
|
||||
['--filter-out'] = set_pattern_value('--filter-out', function(pattern)
|
||||
opts.filter_out = pattern
|
||||
table.insert(opts.filter_out, pattern)
|
||||
end),
|
||||
['--lpath'] = append_value(opts.lpaths),
|
||||
['--cpath'] = append_value(opts.cpaths),
|
||||
|
||||
Reference in New Issue
Block a user