fix test_func (#209)

* fix test_func

* fix test_func
pull/213/head
WDdxRW 2 years ago committed by GitHub
parent 46052e6450
commit 4edd1c289e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -83,6 +83,15 @@ M.get_build_tags = function(args, tbl)
end
local function get_test_path()
local path = vim.fn.expand("%:p:h")
local relative_path = vim.fn.fnamemodify(path, ":.")
if path == relative_path then
return path
end
return "." .. sep .. relative_path
end
local function richgo(cmd)
if cmd[1] == "go" and vfn.executable("richgo") == 1 then
cmd[1] = "richgo"
@ -272,7 +281,7 @@ end
M.test_package = function(...)
local args = { ... }
log(args)
local fpath = "." .. sep .. vfn.fnamemodify(vfn.expand("%:h"), ":.") .. sep .. "..."
local fpath = get_test_path() .. sep .. "..."
utils.log("fpath: " .. fpath)
return run_test(fpath, args)
end
@ -362,7 +371,7 @@ M.test_func = function(...)
table.insert(cmd, [['^]] .. ns.name .. [[$']])
end
local fpath = "." .. sep .. vfn.fnamemodify(vfn.expand("%:h"), ":.")
local fpath = get_test_path()
table.insert(cmd, fpath)
if test_runner == "dlv" then

Loading…
Cancel
Save