testing

package
v0.0.0-...-ffd3a61 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllocsPerRun

func AllocsPerRun(runs int, f func()) (avg float64)

func CoverMode

func CoverMode()

func Coverage

func Coverage() float64

func Entrypoint

func Entrypoint(match string, skip string, tests []gosimruntime.Test) bool

func Init

func Init()

func Main

func Main(matchString func(pat, str string) (bool, error), tests []InternalTest, benchmarks []InternalBenchmark, examples []InternalExample)

func RegisterCover

func RegisterCover(c Cover)

func RunBenchmarks

func RunBenchmarks(matchString func(pat, str string) (bool, error), benchmarks []InternalBenchmark)

func RunExamples

func RunExamples(matchString func(pat, str string) (bool, error), examples []InternalExample) (ok bool)

func RunTests

func RunTests(matchString func(pat, str string) (bool, error), tests []InternalTest) (ok bool)

func Short

func Short() bool

func Testing

func Testing() bool

func Verbose

func Verbose() bool

Types

type B

type B struct {
	// contains filtered or unexported fields
}

func (*B) Cleanup

func (c *B) Cleanup(f func())

func (*B) Error

func (c *B) Error(a ...any)

func (*B) Errorf

func (c *B) Errorf(format string, a ...any)

func (*B) Fail

func (c *B) Fail()

func (*B) FailNow

func (c *B) FailNow()

func (*B) Failed

func (c *B) Failed() bool

func (*B) Fatal

func (c *B) Fatal(a ...any)

func (*B) Fatalf

func (c *B) Fatalf(format string, a ...any)

func (*B) Helper

func (c *B) Helper()

func (*B) Log

func (c *B) Log(a ...any)

func (*B) Logf

func (c *B) Logf(format string, a ...any)

func (*B) Name

func (c *B) Name() string

func (*B) Setenv

func (b *B) Setenv(key, value string)

func (*B) Skip

func (c *B) Skip(a ...any)

func (*B) SkipNow

func (c *B) SkipNow()

func (*B) Skipf

func (c *B) Skipf(format string, a ...any)

func (*B) Skipped

func (c *B) Skipped() bool

func (*B) TempDir

func (c *B) TempDir() string

type Cover

type Cover struct {
	Mode            string
	Counters        map[string][]uint32
	Blocks          map[string][]CoverBlock
	CoveredPackages string
}

type CoverBlock

type CoverBlock struct {
	Line0 uint32 // Line number for block start.
	Col0  uint16 // Column number for block start.
	Line1 uint32 // Line number for block end.
	Col1  uint16 // Column number for block end.
	Stmts uint16 // Number of statements included in this block.
}

type F

type F struct{}

type InternalBenchmark

type InternalBenchmark struct {
	Name string
	F    func(b *B)
}

type InternalExample

type InternalExample struct {
	Name      string
	F         func()
	Output    string
	Unordered bool
}

type InternalFuzzTarget

type InternalFuzzTarget struct {
	Name string
	Fn   func(f *F)
}

type InternalTest

type InternalTest struct {
	Name string
	F    func(*T)
}

type PB

type PB struct{}

type T

type T struct {
	// contains filtered or unexported fields
}

func (*T) Cleanup

func (c *T) Cleanup(f func())

func (*T) Deadline

func (t *T) Deadline() (time.Time, bool)

func (*T) Error

func (c *T) Error(a ...any)

func (*T) Errorf

func (c *T) Errorf(format string, a ...any)

func (*T) Fail

func (c *T) Fail()

func (*T) FailNow

func (c *T) FailNow()

func (*T) Failed

func (c *T) Failed() bool

func (*T) Fatal

func (c *T) Fatal(a ...any)

func (*T) Fatalf

func (c *T) Fatalf(format string, a ...any)

func (*T) Helper

func (c *T) Helper()

func (*T) Log

func (c *T) Log(a ...any)

func (*T) Logf

func (c *T) Logf(format string, a ...any)

func (*T) Name

func (c *T) Name() string

func (*T) Parallel

func (t *T) Parallel()

func (*T) Run

func (t *T) Run(name string, f func(t *T)) bool

Run runs f as a subtest of t called name. It runs f in a separate goroutine and blocks until f returns or calls t.Parallel to become a parallel test. Run reports whether f succeeded (or at least did not fail before calling t.Parallel).

Run may be called simultaneously from multiple goroutines, but all such calls must return before the outer test function for t returns.

func (*T) Setenv

func (t *T) Setenv(key, value string)

func (*T) Skip

func (c *T) Skip(a ...any)

func (*T) SkipNow

func (c *T) SkipNow()

func (*T) Skipf

func (c *T) Skipf(format string, a ...any)

func (*T) Skipped

func (c *T) Skipped() bool

func (*T) TempDir

func (c *T) TempDir() string

type TB

type TB interface {
	Cleanup(func())
	Error(args ...any)
	Errorf(format string, args ...any)
	Fail()
	FailNow()
	Failed() bool
	Fatal(args ...any)
	Fatalf(format string, args ...any)
	Helper()
	Log(args ...any)
	Logf(format string, args ...any)
	Name() string
	Setenv(key, value string)
	Skip(args ...any)
	SkipNow()
	Skipf(format string, args ...any)
	Skipped() bool
	TempDir() string
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

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