expect

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Expectation

type Expectation interface {
	To() Expectation
	Be() Expectation
	Is() Expectation
	Should() Expectation

	Not() Expectation
	IsNot() Expectation
	DoesNot() Expectation

	At(index interface{}) Expectation

	Nil()
	True()
	False()
	Empty()

	HasLength(expected int)
	HaveLength(expected int)

	Eq(expected interface{})
	Equal(expected interface{})
	Equals(expected interface{})
	EqualTo(expected interface{})

	Match(pattern string)
	Matches(pattern string)
}

Expectation about a value or behavior

func Faulty

func Faulty(t *testing.T, err error) Expectation

Faulty returns a new Fault

func Value

func Value(t *testing.T, actual interface{}) Expectation

Value returns a new value-based Expectation

type ExpectedValue

type ExpectedValue struct {
	*testing.T
	// contains filtered or unexported fields
}

ExpectedValue is an expectation on a realized value

func (*ExpectedValue) At added in v0.0.2

func (e *ExpectedValue) At(index interface{}) Expectation

At returns an expectation about the element at the given index

func (*ExpectedValue) Be

func (e *ExpectedValue) Be() Expectation

Be returns the current expectation

func (*ExpectedValue) DoesNot

func (e *ExpectedValue) DoesNot() Expectation

DoesNot is equivalent to Not()

func (*ExpectedValue) Empty

func (e *ExpectedValue) Empty()

Empty asserts the value has length 0

func (*ExpectedValue) Eq

func (e *ExpectedValue) Eq(expected interface{})

Eq is equivalent to Equals()

func (*ExpectedValue) Equal

func (e *ExpectedValue) Equal(expected interface{})

Equal is equivalent to Equals()

func (*ExpectedValue) EqualTo

func (e *ExpectedValue) EqualTo(expected interface{})

EqualTo is equivalent to Equals()

func (*ExpectedValue) Equals

func (e *ExpectedValue) Equals(expected interface{})

Equals asserts equality to an expected value

func (*ExpectedValue) False

func (e *ExpectedValue) False()

False asserts the value is false

func (*ExpectedValue) HasLength

func (e *ExpectedValue) HasLength(expected int)

HasLength asserts the value is an array with a given length

func (*ExpectedValue) HaveLength

func (e *ExpectedValue) HaveLength(expected int)

HaveLength is equivalent to HasLength()

func (*ExpectedValue) Is

func (e *ExpectedValue) Is() Expectation

Is returns the current expectation

func (*ExpectedValue) IsNot

func (e *ExpectedValue) IsNot() Expectation

IsNot is equivalent to Not()

func (*ExpectedValue) Match

func (e *ExpectedValue) Match(pattern string)

Match is equivalent to Matches()

func (*ExpectedValue) Matches

func (e *ExpectedValue) Matches(pattern string)

Matches asserts that the value matches a given pattern

func (*ExpectedValue) Nil

func (e *ExpectedValue) Nil()

Nil asserts the value is nil

func (*ExpectedValue) Not

func (e *ExpectedValue) Not() Expectation

Not negates the current expectation

func (*ExpectedValue) Should

func (e *ExpectedValue) Should() Expectation

Should returns the current expectation

func (*ExpectedValue) To

func (e *ExpectedValue) To() Expectation

To returns the current expectation

func (*ExpectedValue) True

func (e *ExpectedValue) True()

True asserts the value is true

type Fault

type Fault struct {
	*testing.T
	// contains filtered or unexported fields
}

Fault is an expectation that always results in an error

func (*Fault) At added in v0.0.2

func (f *Fault) At(index interface{}) Expectation

At returns the current expectation

func (*Fault) Be

func (f *Fault) Be() Expectation

Be returns the current expectation

func (*Fault) DoesNot

func (f *Fault) DoesNot() Expectation

DoesNot returns the current expectation

func (*Fault) Empty

func (f *Fault) Empty()

Empty always results in an error

func (*Fault) Eq

func (f *Fault) Eq(expected interface{})

Eq always results in an error

func (*Fault) Equal

func (f *Fault) Equal(expected interface{})

Equal always results in an error

func (*Fault) EqualTo

func (f *Fault) EqualTo(expected interface{})

EqualTo always results in an error

func (*Fault) Equals

func (f *Fault) Equals(expected interface{})

Equals always results in an error

func (*Fault) False

func (f *Fault) False()

False always results in an error

func (*Fault) HasLength

func (f *Fault) HasLength(expected int)

HasLength always results in an error

func (*Fault) HaveLength

func (f *Fault) HaveLength(expected int)

HaveLength always results in an error

func (*Fault) Is

func (f *Fault) Is() Expectation

Is returns the current expectation

func (*Fault) IsNot

func (f *Fault) IsNot() Expectation

IsNot returns the current expectation

func (*Fault) Match

func (f *Fault) Match(pattern string)

Match always results in an error

func (*Fault) Matches

func (f *Fault) Matches(pattern string)

Matches always results in an error

func (*Fault) Nil

func (f *Fault) Nil()

Nil always results in an error

func (*Fault) Not

func (f *Fault) Not() Expectation

Not returns the current expectation

func (*Fault) Should

func (f *Fault) Should() Expectation

Should returns the current expectation

func (*Fault) To

func (f *Fault) To() Expectation

To returns the current expectation

func (*Fault) True

func (f *Fault) True()

True always results in an error

type Negation

type Negation struct {
	*testing.T
	// contains filtered or unexported fields
}

Negation is a negated expectation

func (*Negation) At added in v0.0.2

func (not *Negation) At(index interface{}) Expectation

At returns an negated expectation about the element at the given index

func (*Negation) Be

func (not *Negation) Be() Expectation

Be returns the current Expectation

func (*Negation) DoesNot

func (not *Negation) DoesNot() Expectation

DoesNot is equivalent to Not()

func (*Negation) Empty

func (not *Negation) Empty()

Empty asserts the value is a non-empty array

func (*Negation) Eq

func (not *Negation) Eq(given interface{})

Eq is equivalent to Equals()

func (*Negation) Equal

func (not *Negation) Equal(given interface{})

Equal is equivalent to Equals()

func (*Negation) EqualTo

func (not *Negation) EqualTo(given interface{})

EqualTo is equivalent to Equals()

func (*Negation) Equals

func (not *Negation) Equals(given interface{})

Equals asserts inequality to a given value

func (*Negation) False

func (not *Negation) False()

False asserts the value is not false

func (*Negation) HasLength

func (not *Negation) HasLength(given int)

HasLength asserts the value is an array with length != given

func (*Negation) HaveLength

func (not *Negation) HaveLength(given int)

HaveLength is equivalent to HasLength()

func (*Negation) Is

func (not *Negation) Is() Expectation

Is returns the current Expectation

func (*Negation) IsNot

func (not *Negation) IsNot() Expectation

IsNot is equivalent to Not()

func (*Negation) Match

func (not *Negation) Match(pattern string)

Match is equivalent to Matches()

func (*Negation) Matches

func (not *Negation) Matches(pattern string)

Matches asserts that the value does not match a given pattern

func (*Negation) Nil

func (not *Negation) Nil()

Nil asserts the value is not nil

func (*Negation) Not

func (not *Negation) Not() Expectation

Not negates the current Expectation

func (*Negation) Should

func (not *Negation) Should() Expectation

Should returns the current Expectation

func (*Negation) To

func (not *Negation) To() Expectation

To returns the current Expectation

func (*Negation) True

func (not *Negation) True()

True asserts the value is not true

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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