Skip to content

Commit

Permalink
refactor: rename positions (test names) detection
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikaverpil committed Jun 15, 2024
1 parent ba05767 commit 851da01
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ local lib = require("neotest.lib")

local M = {}

function M.discover_positions(file_path)
--- Detect test names in Go *._test.go files.
--- @param file_path string
function M.detect_tests(file_path)
local functions_and_methods = [[
;;query
((function_declaration
Expand Down
7 changes: 5 additions & 2 deletions lua/neotest-golang/init.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
-- This is the main entry point for the neotest-golang adapter. It follows the
-- Neotest interface: https://github.com/nvim-neotest/neotest/blob/master/lua/neotest/adapters/interface.lua

local options = require("neotest-golang.options")
local discover_positions = require("neotest-golang.discover_positions")
local ast = require("neotest-golang.ast")
local runspec_dir = require("neotest-golang.runspec_dir")
local runspec_test = require("neotest-golang.runspec_test")
local results_dir = require("neotest-golang.results_dir")
Expand Down Expand Up @@ -54,7 +57,7 @@ end
---@param file_path string Absolute file path
---@return neotest.Tree | nil
function M.Adapter.discover_positions(file_path)
return discover_positions.discover_positions(file_path)
return ast.detect_tests(file_path)
end

---Build the runspec, which describes how to execute the test(s).
Expand Down

0 comments on commit 851da01

Please sign in to comment.