Documentation ¶
Index ¶
- func Contains[V comparable, S ~[]V](t T, item V, slice S)
- func ElementsMatch[V cmp.Ordered, S ~[]V](t T, expected, actual S)
- func Empty[V comparable](t T, item V)
- func EmptyValue[V comparable](t T, item *V)
- func Equal[V comparable](t T, expected, actual V)
- func EqualElements[V cmp.Ordered, S ~[]V](t T, expected, actual S)
- func EqualValue[V comparable](t T, expected, actual *V)
- func False(t T, value bool)
- func NilError(t T, err error)
- func True(t T, value bool)
- type T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Contains ¶
func Contains[V comparable, S ~[]V](t T, item V, slice S)
Contains checks if the input slice contains the input item, provided that they are of a comparable type.
func ElementsMatch ¶
ElementsMatch asserts that the elements in the expected slice match the elements in the actual slice, regardless of their order. If order is important, either slices.Equal or EqualElements should be preferable options.
Ex:
- expected: [1, 2, 3]
- actual: [3, 1, 2]
- result: OK
func Empty ¶
func Empty[V comparable](t T, item V)
Empty asserts that the input item is empty -- applicable for concrete types. For pointer types, see EmptyValue instead.
Note that this function does not check if the input is an interface that carries a nil input.
func EmptyValue ¶
func EmptyValue[V comparable](t T, item *V)
EmptyValue asserts that the pointer to the input item is empty -- be it a zero input or nil, however applicable.
Note that this function does not check if the input is an interface that carries a nil input.
func Equal ¶
func Equal[V comparable](t T, expected, actual V)
Equal asserts that two values are equal, provided that they are of a comparable type -- applicable for concrete types. For pointer types, see EqualValue instead.
func EqualElements ¶
EqualElements asserts that the elements match the ones in the actual slice, in both position and input. It is a shorthand for calling slices.Equal.
Ex:
- expected: [1, 2, 3]
- actual: [1, 2, 3]
- result: OK
func EqualValue ¶
func EqualValue[V comparable](t T, expected, actual *V)
EqualValue asserts that the values in the two input pointers are equal, provided that they are of a comparable type.
Types ¶
type T ¶
type T interface { // Logf formats its arguments according to the format, analogous to Printf, and records the text in the error log. // A final newline is added if not provided. // // For tests, the text will be printed only if the test fails or the -test.v flag is set. // // For benchmarks, the text is always printed to avoid having performance depend on the input of the -test.v flag. Logf(format string, args ...any) // Fail marks the function as having failed but continues execution. Fail() }