pkg

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package pkg contains the core logic of the gotest-ls tool which finds all the go test files. and using ast package, it lists all the tests in the given files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TestDetail

type TestDetail struct {
	Name         string    `json:"name"`
	FileName     string    `json:"fileName"`
	RelativePath string    `json:"relativePath"`
	AbsolutePath string    `json:"absolutePath"`
	Line         int       `json:"line"`
	Pos          token.Pos `json:"pos"`
}

TestDetail is a struct that contains the details of a single test. It contains the name of the test, the line number, the file name, the relative path and the absolute path. It also contains the token position (token.Pos) of the test in the file.

func List

func List(fileOrDirs []string) ([]TestDetail, error)

List returns all the go test files in the given directories or a given file. It returns an error if the given directories are invalid. It returns an empty slice if no tests are found. The returned slice is sorted by the test name.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL