import deps at top of file, rename module
This commit is contained in:
parent
7ca1c039fe
commit
c8adec2880
3 changed files with 13 additions and 16 deletions
|
|
@ -1,5 +1,6 @@
|
|||
local function generate(row, col)
|
||||
local ts_utils = require "gopher._utils.ts"
|
||||
|
||||
local function generate(row, col)
|
||||
local comment, ns = nil, nil
|
||||
|
||||
ns = ts_utils.get_package_node_at_pos(row, col, nil, false)
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
local Job = require "plenary.job"
|
||||
local ts_utils = require "gopher._utils.ts"
|
||||
local c = require("gopher.config").config.commands
|
||||
local u = require "gopher._utils"
|
||||
local M = {}
|
||||
local tests = {}
|
||||
|
||||
---@param cmd_args table
|
||||
local function run(cmd_args)
|
||||
local Job = require "plenary.job"
|
||||
local c = require("gopher.config").config.commands
|
||||
|
||||
Job:new({
|
||||
command = c.gotests,
|
||||
args = cmd_args,
|
||||
|
|
@ -30,9 +30,7 @@ end
|
|||
|
||||
---generate unit test for one function
|
||||
---@param parallel boolean
|
||||
function M.func_test(parallel)
|
||||
local ts_utils = require "gopher._utils.ts"
|
||||
|
||||
function tests.func_test(parallel)
|
||||
local ns = ts_utils.get_func_method_node_at_pos(unpack(vim.api.nvim_win_get_cursor(0)))
|
||||
if ns == nil or ns.name == nil then
|
||||
u.notify("cursor on func/method and execute the command again", "info")
|
||||
|
|
@ -49,7 +47,7 @@ end
|
|||
|
||||
---generate unit tests for all functions in current file
|
||||
---@param parallel boolean
|
||||
function M.all_tests(parallel)
|
||||
function tests.all_tests(parallel)
|
||||
local cmd_args = { "-all" }
|
||||
if parallel then
|
||||
table.insert(cmd_args, "-parallel")
|
||||
|
|
@ -60,7 +58,7 @@ end
|
|||
|
||||
---generate unit tests for all exported functions
|
||||
---@param parallel boolean
|
||||
function M.all_exported_tests(parallel)
|
||||
function tests.all_exported_tests(parallel)
|
||||
local cmd_args = {}
|
||||
if parallel then
|
||||
table.insert(cmd_args, "-parallel")
|
||||
|
|
@ -70,4 +68,4 @@ function M.all_exported_tests(parallel)
|
|||
add_test(cmd_args)
|
||||
end
|
||||
|
||||
return M
|
||||
return tests
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
local c = require("gopher.config").config.commands
|
||||
local Job = require "plenary.job"
|
||||
local ts_utils = require "gopher._utils.ts"
|
||||
local u = require "gopher._utils"
|
||||
|
||||
---@return string
|
||||
local function get_struct()
|
||||
local ts_utils = require "gopher._utils.ts"
|
||||
|
||||
local ns = ts_utils.get_struct_node_at_pos(unpack(vim.api.nvim_win_get_cursor(0)))
|
||||
if ns == nil then
|
||||
u.notify("put cursor on a struct or specify a receiver", "info")
|
||||
|
|
@ -19,9 +20,6 @@ local function get_struct()
|
|||
end
|
||||
|
||||
return function(...)
|
||||
local c = require("gopher.config").config.commands
|
||||
local Job = require "plenary.job"
|
||||
|
||||
local args = { ... }
|
||||
local iface, recv_name = "", ""
|
||||
local recv = get_struct()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue