unit_tests

package
v0.0.0-...-40e1022 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("person not found")

Functions

func LoadAndPrint

func LoadAndPrint(loader Loader, ID int, dest io.Writer)

func LoadPersonName

func LoadPersonName(loader PersonLoader, ID int) (string, error)

func Round

func Round(in float64) int

Round the supplied number to the nearest integer

func TestLanguageFeatures

func TestLanguageFeatures(t *testing.T)

func TestLoadAndPrint_error

func TestLoadAndPrint_error(t *testing.T)

func TestLoadAndPrint_happyPath

func TestLoadAndPrint_happyPath(t *testing.T)

func TestLoadAndPrint_notFound

func TestLoadAndPrint_notFound(t *testing.T)

func TestLoadPersonName

func TestLoadPersonName(t *testing.T)

func TestLoadPersonNameStubs

func TestLoadPersonNameStubs(t *testing.T)

func TestRound

func TestRound(t *testing.T)

func TestRound_down

func TestRound_down(t *testing.T)

func TestRound_noChange

func TestRound_noChange(t *testing.T)

func TestRound_up

func TestRound_up(t *testing.T)

Types

type Loader

type Loader interface {
	Load(ID int) (*Pet, error)
}

type Person

type Person struct {
	Name string
}

type PersonLoader

type PersonLoader interface {
	Load(ID int) (*Person, error)
}

type PersonLoaderMock

type PersonLoaderMock struct {
	mock.Mock
}

Mocked implementation of PersonLoader

func (*PersonLoaderMock) Load

func (p *PersonLoaderMock) Load(ID int) (*Person, error)

type PersonLoaderStub

type PersonLoaderStub struct {
	Person *Person
	Error  error
}

Stubbed implementation of PersonLoader

func (*PersonLoaderStub) Load

func (p *PersonLoaderStub) Load(ID int) (*Person, error)

type Pet

type Pet struct {
	Name string
}

func NewPet

func NewPet(name string) *Pet

type PetSaver

type PetSaver struct{}

func (PetSaver) Save

func (p PetSaver) Save(pet Pet) (int, error)

save the supplied pet and return the ID

Jump to

Keyboard shortcuts

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