diff --git a/lua/go/gotest.lua b/lua/go/gotest.lua index 0fc88e1df..bc34d1b7a 100644 --- a/lua/go/gotest.lua +++ b/lua/go/gotest.lua @@ -501,11 +501,6 @@ end M.test_func = function(...) local args = { ... } or {} log(args) - - local ns = M.get_test_func_name() - if empty(ns) then - return M.select_tests() - end local bufnr = get_test_filebufnr() local ok, p = vim.treesitter.get_parser(bufnr, 'go') if not ok or not p then @@ -515,6 +510,10 @@ M.test_func = function(...) vim.log.levels.WARN ) end + local ns = M.get_test_func_name() + if empty(ns) then + return M.select_tests() + end return run_tests_with_ts_node(args, ns) end diff --git a/lua/tests/go_test_spec.lua b/lua/tests/go_test_spec.lua index ee728f76b..ebe65b68a 100644 --- a/lua/tests/go_test_spec.lua +++ b/lua/tests/go_test_spec.lua @@ -4,6 +4,7 @@ local busted = require('plenary/busted') local godir = cur_dir .. '/lua/tests/fixtures' -- hack latest nvim treestitter get_node_text bug +-- TODO remove this after nvim-treesitter is fixed local nvim11 = vim.fn.has('nvim-0.11') == 1 describe('should run func test', function()