digtest

package
v1.14.1 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package digtest provides utilities used by dig internally to test its own functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Container

type Container struct {
	*dig.Container
	// contains filtered or unexported fields
}

Container wraps dig.Container to provide methods for easier testing.

func New

func New(t testing.TB, opts ...dig.Option) *Container

New builds a new testing container.

func (*Container) RequireDecorate

func (c *Container) RequireDecorate(f interface{}, opts ...dig.DecorateOption)

RequireDecorate decorates the scope using the given function, halting the test if it fails.

func (*Container) RequireInvoke

func (c *Container) RequireInvoke(f interface{}, opts ...dig.InvokeOption)

RequireInvoke invokes the given function to the container, halting the test if it fails.

func (*Container) RequireProvide

func (c *Container) RequireProvide(f interface{}, opts ...dig.ProvideOption)

RequireProvide provides the given function to the container, halting the test if it fails.

func (*Container) Scope

func (c *Container) Scope(name string, opts ...dig.ScopeOption) *Scope

Scope builds a subscope of this container with the given name. The returned Scope is similarly augmented to ease testing.

type Scope

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

Scope wraps dig.Scope to provide methods for easier testing.

func (*Scope) RequireDecorate

func (s *Scope) RequireDecorate(f interface{}, opts ...dig.DecorateOption)

RequireDecorate decorates the scope using the given function, halting the test if it fails.

func (*Scope) RequireInvoke

func (s *Scope) RequireInvoke(f interface{}, opts ...dig.InvokeOption)

RequireInvoke invokes the given function to the scope, halting the test if it fails.

func (*Scope) RequireProvide

func (s *Scope) RequireProvide(f interface{}, opts ...dig.ProvideOption)

RequireProvide provides the given function to the scope, halting the test if it fails.

func (*Scope) Scope

func (s *Scope) Scope(name string, opts ...dig.ScopeOption) *Scope

Scope builds a subscope of this scope with the given name. The returned Scope is similarly augmented to ease testing.

Jump to

Keyboard shortcuts

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