Skip to content

Commit

Permalink
fix(neotest): avoid iterating content multiple times to find test attrs
Browse files Browse the repository at this point in the history
  • Loading branch information
jameshurst committed Feb 11, 2024
1 parent b45d81e commit 84224a1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lua/rustaceanvim/neotest/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ NeotestAdapter.is_test_file = function(file_path)

local content = lib.files.read(file_path)
local test_attributes = {
'test',
'rstest',
'rstest::rstest',
['test'] = true,
['rstest'] = true,
['rstest::rstest'] = true,
}
for _, attr in ipairs(test_attributes) do
if content:find('#%[' .. attr .. '%]') then
for attr in content:gmatch('#%[([%w_:]+)%]') do
if test_attributes[attr] then
return true
end
end
Expand Down

0 comments on commit 84224a1

Please sign in to comment.