fix: test file function (#78)

Test file function wasn't working anymore. It didn't find functions to
test even though the sed found them.

Problem was in the escaping the pipe sign.

Co-authored-by: Ales Brelih <ales.brelih@3fs.si>
pull/79/head
Aleš Brelih 2 years ago committed by GitHub
parent d369ef454d
commit 3c44e3a998
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -236,7 +236,7 @@ M.test_file = function(...)
-- local testcases = [[sed -n 's/func.*\(Test.*\)(.*/\1/p' | xargs | sed 's/ /\\\|/g']]
local fpath = vim.fn.expand("%:p")
-- utils.log(args)
local cmd = [[cat ]] .. fpath .. [[| sed -n 's/func.*\(Test.*\)(.*/\1/p' | xargs | sed 's/ /\\|/g']]
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
local tests = vim.fn.systemlist(cmd)
utils.log(cmd, tests)

Loading…
Cancel
Save