testfixture

package
v0.0.0-...-b5d9cbe Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package testfixture provides an implementation of testing.FixtureImpl to be used in unit tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fixture

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

Fixture is a customizable implementation of testing.FixtureImpl.

func New

func New(opts ...Option) *Fixture

New creates a new fake fixture.

func (*Fixture) PostTest

func (f *Fixture) PostTest(ctx context.Context, s *testing.FixtTestState)

PostTest implements the fixture lifecycle method by a user-supplied callback.

func (*Fixture) PreTest

func (f *Fixture) PreTest(ctx context.Context, s *testing.FixtTestState)

PreTest implements the fixture lifecycle method by a user-supplied callback.

func (*Fixture) Reset

func (f *Fixture) Reset(ctx context.Context) error

Reset implements the fixture lifecycle method by a user-supplied callback.

func (*Fixture) SetUp

func (f *Fixture) SetUp(ctx context.Context, s *testing.FixtState) interface{}

SetUp implements the fixture lifecycle method by a user-supplied callback.

func (*Fixture) TearDown

func (f *Fixture) TearDown(ctx context.Context, s *testing.FixtState)

TearDown implements the fixture lifecycle method by a user-supplied callback.

type Option

type Option func(tf *Fixture)

Option is an option passed to New to customize a constructed Fixture.

func WithPostTest

func WithPostTest(f func(ctx context.Context, s *testing.FixtTestState)) Option

WithPostTest returns an option to set a function called back on PostTest.

func WithPreTest

func WithPreTest(f func(ctx context.Context, s *testing.FixtTestState)) Option

WithPreTest returns an option to set a function called back on PreTest.

func WithReset

func WithReset(f func(ctx context.Context) error) Option

WithReset returns an option to set a function called back on Reset.

func WithSetUp

func WithSetUp(f func(ctx context.Context, s *testing.FixtState) interface{}) Option

WithSetUp returns an option to set a function called back on SetUp.

func WithTearDown

func WithTearDown(f func(ctx context.Context, s *testing.FixtState)) Option

WithTearDown returns an option to set a function called back on TearDown.

Jump to

Keyboard shortcuts

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