Documentation
¶
Overview ¶
Package assert (trial/assert) is a simple and lightweight assertion library.
Example:
import "github.com/jgroeneveld/trial/assert" assert.Equal(t, 1, 2) Output: unit_test.go:42: Not equal: Expected: 1 Actual: 2
Additional arguments to overwrite the message
assert.Equal(t, 1, 2, "numbers dont match for %q", "my param") Output: unit_test.go:42: numbers dont match for "my param": Expected: 1 Actual: 2
See https://github.com/jgroeneveld/trial for more examples.
Also see https://github.com/jgroeneveld/schema for easier JSON Schema testing.
Index ¶
- func DeepEqual(t testingT, expected interface{}, actual interface{}, msgf ...interface{})
- func Equal(t testingT, expected interface{}, actual interface{}, msgf ...interface{})
- func False(t testingT, expression bool, msgf ...interface{})
- func JSONSchema(t testingT, r io.Reader, matcher schema.Matcher, msgf ...interface{})
- func MustBeDeepEqual(t testingT, expected interface{}, actual interface{}, msgf ...interface{})
- func MustBeEqual(t testingT, expected interface{}, actual interface{}, msgf ...interface{})
- func MustBeFalse(t testingT, expression bool, msgf ...interface{})
- func MustBeNil(t testingT, expression interface{}, msgf ...interface{})
- func MustBeTrue(t testingT, expression bool, msgf ...interface{})
- func MustMatchJSONSchema(t testingT, r io.Reader, matcher schema.Matcher, msgf ...interface{})
- func MustNotBeEqual(t testingT, expected interface{}, actual interface{}, msgf ...interface{})
- func MustNotBeNil(t testingT, expression interface{}, msgf ...interface{})
- func Nil(t testingT, expression interface{}, msgf ...interface{})
- func NotEqual(t testingT, expected interface{}, actual interface{}, msgf ...interface{})
- func NotNil(t testingT, expression interface{}, msgf ...interface{})
- func True(t testingT, expression bool, msgf ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeepEqual ¶
func DeepEqual(t testingT, expected interface{}, actual interface{}, msgf ...interface{})
DeepEqual test if two values are deeply equal.
func Equal ¶
func Equal(t testingT, expected interface{}, actual interface{}, msgf ...interface{})
Equal checks if two values are equal. Reports if types are different, even though values "look" the same.
func False ¶
func False(t testingT, expression bool, msgf ...interface{})
False tests if a value is False
func JSONSchema ¶
JSONSchema uses schema to assert that json matches a given structure
func MustBeDeepEqual ¶
func MustBeDeepEqual(t testingT, expected interface{}, actual interface{}, msgf ...interface{})
MustBeDeepEqual test if two values are deeply equal. Will FailNow if expectation is not met.
func MustBeEqual ¶
func MustBeEqual(t testingT, expected interface{}, actual interface{}, msgf ...interface{})
MustBeEqual checks if two values are equal. Reports if types are different, even though values "look" the same. Will FailNow if expectation is not met.
func MustBeFalse ¶
func MustBeFalse(t testingT, expression bool, msgf ...interface{})
MustBeFalse tests if a value is False Will FailNow if expectation is not met.
func MustBeNil ¶
func MustBeNil(t testingT, expression interface{}, msgf ...interface{})
MustBeNil tests if a value is Nil Will FailNow if expectation is not met.
func MustBeTrue ¶
func MustBeTrue(t testingT, expression bool, msgf ...interface{})
MustBeTrue tests if a value is true Will FailNow if expectation is not met.
func MustMatchJSONSchema ¶
MustMatchJSONSchema uses schema to assert that json matches a given structure Will FailNow if expectation is not met.
func MustNotBeEqual ¶
func MustNotBeEqual(t testingT, expected interface{}, actual interface{}, msgf ...interface{})
MustNotBeEqual checks if two values are equal. Will FailNow if expectation is not met.
func MustNotBeNil ¶
func MustNotBeNil(t testingT, expression interface{}, msgf ...interface{})
MustNotBeNil tests if a value is Not Nil Will FailNow if expectation is not met.
func Nil ¶
func Nil(t testingT, expression interface{}, msgf ...interface{})
Nil tests if a value is Nil
func NotEqual ¶
func NotEqual(t testingT, expected interface{}, actual interface{}, msgf ...interface{})
NotEqual checks if two values are not equal.
Types ¶
This section is empty.