lab

package
v0.0.0-...-ec844c3 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetDependency

func SetDependency(consumer depender, provider depender) error

func Unpack

func Unpack[T any](harness *Harness, fixture *Fixture[T]) (T, bool)

func UseHarness

func UseHarness[Ctx TBConstraint](ctx Ctx, harness *Harness) (Assertions, *Harness)

Types

type Assertions

type Assertions = *require.Assertions

func UseFixture

func UseFixture[Ctx TBConstraint, T any](ctx Ctx, fixture *Fixture[T]) (Assertions, T)

func UseHooks

func UseHooks[Ctx TBConstraint, Fixture any](ctx Ctx, setup func() (Fixture, error), teardown func(Fixture) error) (Assertions, Fixture)

type Case

type Case[Fixture any] struct {
	Description string
	Test        func(assert Assertions, fixture Fixture)
}

func TestCase

func TestCase[Fixture any](description string, testFn func(assert Assertions, fixture Fixture)) Case[Fixture]

type Fixture

type Fixture[T any] struct {
	// contains filtered or unexported fields
}

func NewFixture

func NewFixture[T any](setup func(*Harness) (T, error), teardown func(*Harness, T) error) *Fixture[T]

func (*Fixture[T]) Dependencies

func (s *Fixture[T]) Dependencies() internal.Set[depender]

func (*Fixture[T]) Setup

func (s *Fixture[T]) Setup(harness *Harness) (T, error)

func (*Fixture[T]) Teardown

func (s *Fixture[T]) Teardown(harness *Harness, t T) error

type Harness

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

func NewHarness

func NewHarness() *Harness

func Pack

func Pack[T any](harness *Harness, fixture *Fixture[T]) *Harness

func (*Harness) Setup

func (s *Harness) Setup() (*Harness, error)

func (*Harness) Teardown

func (s *Harness) Teardown(harness *Harness) error

type Spec

type Spec[Ctx TBConstraint, Fixture any] struct {
	// contains filtered or unexported fields
}

func NewSpec

func NewSpec[Ctx TBConstraint](ctx Ctx, harness *Harness) Spec[Ctx, *Harness]

func NewSpecWithHooks

func NewSpecWithHooks[Ctx TBConstraint, Fixture any](ctx Ctx, setup func() (Fixture, error), teardown func(Fixture) error) Spec[Ctx, Fixture]

func (Spec[TestType, Fixture]) Run

func (s Spec[TestType, Fixture]) Run(cases ...Case[Fixture])

type TBConstraint

type TBConstraint interface {
	*testing.T | *testing.B
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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