From 65b3c1970974d3bf5614eeb3b8c485f1d8da01e0 Mon Sep 17 00:00:00 2001 From: ray-x Date: Mon, 25 Apr 2022 14:57:27 +1000 Subject: [PATCH] issue #110 use releative path to handle symbolic link --- lua/go/gotest.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lua/go/gotest.lua b/lua/go/gotest.lua index 8b352a1..8ccf773 100644 --- a/lua/go/gotest.lua +++ b/lua/go/gotest.lua @@ -13,6 +13,8 @@ local long_opts = { bench = "b", floatterm = "F", } + +local sep = require("go.utils").sep() local short_opts = "vct:bF" local bench_opts = { "-benchmem", "-cpuprofile", "profile.out" } @@ -76,7 +78,7 @@ local function run_test(path, args) local bench = false local optarg, optind, reminder = getopt.get_opts(args, short_opts, long_opts) if optarg["c"] then - path = vim.fn.expand("%:p:h") + path = "." .. sep .. vim.fn.expand("%:h") -- vim.fn.expand("%:p:h") can not resolve releative path compile = true end if optarg["b"] then @@ -183,7 +185,7 @@ M.test_fun = function(...) local args = { ... } log(args) - local fpath = vim.fn.expand("%:p:h") + local fpath = "." .. sep .. vim.fn.expand("%:h") -- vim.fn.expand("%:p:h") can not resolve releative path -- fpath = fpath:gsub(" ", [[\ ]]) -- fpath = fpath:gsub("-", [[\-]]) -- log(fpath)