revert escape changes, it breaks floaterm run

pull/135/head
ray-x 2 years ago
parent 0cc455457c
commit 56143544d7

@ -173,6 +173,7 @@ function M.make(...)
if _GO_NVIM_CFG.run_in_floaterm or optarg["F"] then
local term = require("go.term").run
cmd = table.concat(cmd, " ")
term({ cmd = cmd, autoclose = false })
return
end

@ -234,7 +234,7 @@ end
M.test_package = function(...)
local args = { ... }
log(args)
local fpath = "." .. sep .. vim.fn.fnamemodify(vim.fn.expand("%:h"), ":.:S") .. sep .. "..."
local fpath = "." .. sep .. vim.fn.fnamemodify(vim.fn.expand("%:h"), ":.") .. sep .. "..."
utils.log("fpath: " .. fpath)
return run_test(fpath, args)
end
@ -312,7 +312,7 @@ M.test_func = function(...)
table.insert(cmd, [[^]] .. ns.name)
end
local fpath = "." .. sep .. vim.fn.fnamemodify(vim.fn.expand("%:h"), ":.:S")
local fpath = "." .. sep .. vim.fn.fnamemodify(vim.fn.expand("%:h"), ":.")
table.insert(cmd, fpath)
if test_runner == "dlv" then
@ -346,7 +346,7 @@ M.test_file = function(...)
-- local testcases = [[sed -n 's/func.*\(Test.*\)(.*/\1/p' | xargs | sed 's/ /\\\|/g']]
-- local fpath = vim.fn.expand("%:p")
local fpath = "." .. sep .. vim.fn.fnamemodify(vim.fn.expand("%:p"), ":.:S")
local fpath = "." .. sep .. vim.fn.fnamemodify(vim.fn.expand("%:p"), ":.")
-- utils.log(args)
local cmd = [[cat ]] .. fpath .. [[| sed -n 's/func.*\(Test.*\)(.*/\1/p' | xargs | sed 's/ /\|/g']]
-- TODO maybe with treesitter or lsp list all functions in current file and regex with Test

@ -434,7 +434,7 @@ function util.rel_path(folder)
if workfolders ~= nil and next(workfolders) then
fpath = "." .. fpath:sub(#workfolders[1] + 1)
end
return "." .. util.sep() .. fn.fnamemodify(vim.fn.expand(mod), ":.:S")
return "." .. util.sep() .. fn.fnamemodify(vim.fn.expand(mod), ":.")
end
function util.rtrim(s)

@ -21,7 +21,7 @@ describe("should run func test", function()
vim.fn.setpos(".", { 0, 5, 11, 0 })
local cmd = require("go.gotest").test_func()
eq({ "go", "test", "-v", "-run", "^Test_branch", "./'lua/tests/fixtures/coverage'" }, cmd)
eq({ "go", "test", "-v", "-run", "^Test_branch", "./lua/tests/fixtures/coverage" }, cmd)
end)
it("should test function inside a source code", function()
--
@ -38,7 +38,7 @@ describe("should run func test", function()
vim.fn.setpos(".", { 0, 6, 11, 0 })
local cmd = require("go.gotest").test_func()
eq({ "go", "test", "-v", "-run", "^Test_branch", "./'lua/tests/fixtures/coverage'" }, cmd)
eq({ "go", "test", "-v", "-run", "^Test_branch", "./lua/tests/fixtures/coverage" }, cmd)
end)
end)
@ -61,7 +61,7 @@ describe("should run test file", function()
vim.fn.setpos(".", { 0, 5, 11, 0 })
local cmd = require("go.gotest").test_file()
eq({ "go", "test", "-v", "-run", "'Test_branch|TestBranch'", "./'lua/tests/fixtures/coverage'" }, cmd)
eq({ "go", "test", "-v", "-run", "'Test_branch|TestBranch'", "./lua/tests/fixtures/coverage" }, cmd)
end)
end)
@ -84,7 +84,7 @@ describe("should run test file with flags", function()
vim.fn.setpos(".", { 0, 5, 11, 0 })
local cmd = require("go.gotest").test_file("-t", "tag1")
eq({ "go", "test", "-tags=tag1", "-v", "-run", "'Test_branch|TestBranch'", "./'lua/tests/fixtures/coverage'" }, cmd)
eq({ "go", "test", "-tags=tag1", "-v", "-run", "'Test_branch|TestBranch'", "./lua/tests/fixtures/coverage" }, cmd)
end)
end)
@ -107,7 +107,7 @@ describe("should run test package", function()
vim.fn.setpos(".", { 0, 1, 1, 0 })
local cmd = require("go.gotest").test_package()
eq({ "go", "test", "-v", "./'lua/tests/fixtures/coverage'/..." }, cmd)
eq({ "go", "test", "-v", "./lua/tests/fixtures/coverage/..." }, cmd)
end)
end)
@ -129,7 +129,7 @@ describe("should run test ", function()
vim.fn.setpos(".", { 0, 6, 1, 0 })
local cmd = require("go.gotest").test("-n", "-t", "tags1")
eq({ "go", "test", "-tags=tags1", "-v", "-run", "^Test_branch", "./'lua/tests/fixtures/coverage'" }, cmd)
eq({ "go", "test", "-tags=tags1", "-v", "-run", "^Test_branch", "./lua/tests/fixtures/coverage" }, cmd)
end)
end)

Loading…
Cancel
Save