Skip to content

Commit

Permalink
fix: regex characters applied twice
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikaverpil committed Jul 15, 2024
1 parent a17f388 commit 39f3399
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lua/neotest-golang/features/dap/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ function M.setup_debugging(cwd)
end
end

--- @param test_name string
--- @param test_name_regex string
--- @return table | nil
function M.get_dap_config(test_name)
function M.get_dap_config(test_name_regex)
-- :help dap-configuration
local dap_config = {
type = "go",
name = "Neotest-golang",
request = "launch",
mode = "test",
program = "${fileDirname}",
args = { "-test.run", "^" .. test_name .. "$" },
args = { "-test.run", test_name_regex },
}

return dap_config
Expand Down
6 changes: 3 additions & 3 deletions lua/neotest-golang/runspec/test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ function M.build(pos, strategy)

--- @type string
local test_name = lib.convert.to_gotest_test_name(pos.id)
test_name = lib.convert.to_gotest_regex_pattern(test_name)
local test_name_regex = lib.convert.to_gotest_regex_pattern(test_name)

local test_cmd, json_filepath = lib.cmd.test_command_in_package_with_regexp(
test_folder_absolute_path,
test_name
test_name_regex
)

local runspec_strategy = nil
if strategy == "dap" then
M.assert_dap_prerequisites()
runspec_strategy = dap.get_dap_config(test_name)
runspec_strategy = dap.get_dap_config(test_name_regex)
logger.debug("DAP strategy used: " .. vim.inspect(runspec_strategy))
dap.setup_debugging(test_folder_absolute_path)
end
Expand Down

0 comments on commit 39f3399

Please sign in to comment.