fix: use strict test function name while debugging (#197)

* fix: use strict test function name while debugging

* fix: use strict test function name while debugging

* Revert "fix: use strict test function name while debugging"

This reverts commit f47dd66c50.

Co-authored-by: zhuyajie <930664@qq.com>
pull/198/head^2
Yajie Zhu 2 years ago committed by GitHub
parent 02db327bc3
commit 6c793a1c6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -341,7 +341,7 @@ M.run = function(...)
else
M.stop() -- rerun
testfunc = require("go.gotest").get_test_func_name()
if not string.find(testfunc.name, "[T|t]est") then
if testfunc and not string.find(testfunc.name, "[T|t]est") then
log("no test func found", testfunc.name)
testfunc = nil -- no test func avalible, run main
end
@ -458,7 +458,7 @@ M.run = function(...)
dap_cfg.program = sep .. "${relativeFileDirname}"
if testfunc then
dap_cfg.args = { "-test.run", "^" .. testfunc.name }
dap_cfg.args = { "-test.run", "^" .. testfunc.name .."$" }
end
dap.configurations.go = { dap_cfg }
dap.continue()
@ -496,7 +496,7 @@ M.run = function(...)
dap_cfg.mode = "debug"
dap_cfg.request = "launch"
if testfunc then
dap_cfg.args = { "-test.run", "^" .. testfunc.name }
dap_cfg.args = { "-test.run", "^" .. testfunc.name .."$" }
dap_cfg.mode = "test"
end
dap_cfg.program = sep .. "${relativeFileDirname}"

Loading…
Cancel
Save