From 851da017b01c38bb08a32ae2598cc61047b8ba9c Mon Sep 17 00:00:00 2001 From: Fredrik Averpil Date: Sat, 15 Jun 2024 17:22:01 +0200 Subject: [PATCH] refactor: rename positions (test names) detection --- lua/neotest-golang/{discover_positions.lua => ast.lua} | 4 +++- lua/neotest-golang/init.lua | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) rename lua/neotest-golang/{discover_positions.lua => ast.lua} (96%) diff --git a/lua/neotest-golang/discover_positions.lua b/lua/neotest-golang/ast.lua similarity index 96% rename from lua/neotest-golang/discover_positions.lua rename to lua/neotest-golang/ast.lua index 5dbe74ea..b4b9edd8 100644 --- a/lua/neotest-golang/discover_positions.lua +++ b/lua/neotest-golang/ast.lua @@ -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 diff --git a/lua/neotest-golang/init.lua b/lua/neotest-golang/init.lua index f38653cc..73cbdbc9 100644 --- a/lua/neotest-golang/init.lua +++ b/lua/neotest-golang/init.lua @@ -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") @@ -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).