Help us shape the future of Go! Take the 2026 Go Developer Survey

testsrc

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package testsrc reads a package's own test sources, for the guard tests that check how its tests are written.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Callee

func Callee(call *ast.CallExpr) string

Callee names the function that call calls: "f" for f(…), "x.f" for x.f(…), and "" for any other form.

func Calls

func Calls(n ast.Node, names ...string) int

Calls counts the calls under n whose Callee is one of names.

func Funcs

func Funcs(t testing.TB, sources fs.FS) map[string]*ast.FuncDecl

Funcs indexes the top-level functions of sources, a package's embedded *_test.go files, by name.

func IsString

func IsString(e ast.Expr, s string) bool

IsString reports whether e is the string literal s.

func ParallelTests

func ParallelTests(t testing.TB, sources fs.FS, match func(body *ast.BlockStmt) bool) []string

ParallelTests names the tests in sources, a package's embedded *_test.go files, that call t.Parallel() and whose body match reports true for.

Types

This section is empty.

Jump to

Keyboard shortcuts

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