mirror of https://github.com/ray-x/go.nvim
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
565 B
Lua
22 lines
565 B
Lua
local M = {}
|
|
local utils = require("go.utils")
|
|
|
|
M.test_fun = function(args)
|
|
|
|
local fpath = vim.fn.expand('%:p:h')
|
|
local row, col = unpack(vim.api.nvim_win_get_cursor(0))
|
|
row, col = row, col + 1
|
|
local ns = require("go.ts.go").get_func_method_node_at_pos(row, col)
|
|
if ns == nil or ns == {} then
|
|
return
|
|
end
|
|
|
|
utils.log("parnode" .. vim.inspect(ns))
|
|
local cmd = [[setl makeprg=go\ test\ -v\ -run\ ^]] .. ns.name .. [[\ ]] .. fpath
|
|
.. [[ | lua require"go.asyncmake".make()]]
|
|
utils.log("test cmd", cmd)
|
|
vim.cmd(cmd)
|
|
end
|
|
|
|
return M
|