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

testing

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddBeamFor

func AddBeamFor(ptr any) Beam

Creates and register a Beam via a struct pointer or reflect.Type of a struct pointer

func GetBeam

func GetBeam[T any]() Beam

GetBeam() retrieve a Beam of type T (T must be a struct pointer or interface)

func GetBeamDefaultInstance

func GetBeamDefaultInstance[T any]() T

GetBeamDefaultInstance() retrieve a Beam instance of type T (T must be a struct pointer or interface)

func GetBeamScopedInstance

func GetBeamScopedInstance[T any]() T

TODO: Remove

func GetLogger

func GetLogger() *logger.Logger

func NewBeamFor

func NewBeamFor(ptr any) Beam

Creates a Beam via a struct pointer or reflect.Type of a struct pointer

func ValErr

func ValErr[T any](val T, err error) T

Types

type BeamWithFoundry

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

func (*BeamWithFoundry[T]) GetFoundry

func (this *BeamWithFoundry[T]) GetFoundry() *Foundry[T]

type BeamWithInject

type BeamWithInject struct {
	Component
	// contains filtered or unexported fields
}

func (*BeamWithInject) GetBeam

func (this *BeamWithInject) GetBeam() *BeamWithValue

func (*BeamWithInject) SetBeam

func (this *BeamWithInject) SetBeam(beam *BeamWithValue)

func (*BeamWithInject) WithBeam

func (this *BeamWithInject) WithBeam(beam *BeamWithValue) *BeamWithInject

type BeamWithValue

type BeamWithValue struct {
	Component
	// contains filtered or unexported fields
}

func (*BeamWithValue) GetValue

func (this *BeamWithValue) GetValue() string

func (*BeamWithValue) SetValue

func (this *BeamWithValue) SetValue(value string)

func (*BeamWithValue) WithValue

func (this *BeamWithValue) WithValue(value string) *BeamWithValue

type TestValuer

type TestValuer interface {
	GetValue() string
	SetValue(string)
}

type TestingComponent

type TestingComponent interface {
	Stereotype
	// contains filtered or unexported methods
}

type TestingContext

type TestingContext interface {
	// ContainerContext
	InitializingContext
	ContainerConfiguration
	// AddBeamFor() adds a Beam for either a struct pointer or a reflect.Type of a struct pointer.
	AddBeamFor(any) (Beam, Error)
	// LoadConfig() will load a configuration map for the current context
	LoadConfig(map[string]any) Error
	// LoadConfigAt() will load a configuration map for the current context at the specified path
	LoadConfigAt(map[string]any, string) Error
	// LoadConfigForProfile() will load a configuration map for a specified profile
	LoadConfigForProfile(map[string]any, string) Error
	// LoadConfigForProfileAt() will load a configuration map for a specified profile at the specified path.
	LoadConfigForProfileAt(map[string]any, string, string) Error
	// Reset() will reset the container. You don't have to do it if you use Gomega.
	Reset()
	// Set the specific type to scan, only for special internal testing cases.
	SetScanFor(rtype reflect.Type)
	GetBeamDefaultInstance(Beam) *container.Instance
	Register(beam Beam) Error
	// EnableScanning() must be called in testing to activate component scanning.
	EnableScanning()
}

func GetContainer

func GetContainer() TestingContext

Jump to

Keyboard shortcuts

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