Skip to content

Commit

Permalink
Fix '$' escaping
Browse files Browse the repository at this point in the history
  • Loading branch information
MisanthropicBit committed Feb 10, 2024
1 parent a3a60e0 commit bb611f3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions lua/neotest-busted/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@ end
---@return string
local function escape_test_pattern_filter(filter)
-- NOTE: The replacement of a literal '%' needs to come first so it does
-- match any earlier replacements that insert a '%'. Also we need to escape
-- '$' for the shell command to work
-- match any earlier replacements that insert a '%'.
return (
filter
:gsub("%%", "%%%%")
Expand All @@ -141,7 +140,7 @@ local function escape_test_pattern_filter(filter)
:gsub("%+", "%%+")
:gsub("%-", "%%-")
:gsub("%?", "%%?")
:gsub("%$", "%%\\$")
:gsub("%$", "%%$")
:gsub("%^", "%%^")
)
end
Expand Down
2 changes: 1 addition & 1 deletion tests/adapter_build_spec_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ describe("adapter.build_spec", function()
"test-output.json",
"--verbose",
"--filter",
[[%^top%-le%[ve]l %(na%*m%+e%-sp%?ac%%e%) 2%\$ test 3]],
[[%^top%-le%[ve]l %(na%*m%+e%-sp%?ac%%e%) 2%$ test 3]],
"./test_files/test1_spec.lua",
})

Expand Down

0 comments on commit bb611f3

Please sign in to comment.