Documentation ¶
Overview ¶
Package assert provides assert helper functions for testing package.
Example:
package somepkg_test import ( . "github.com/chai2010/assert" ) func TestAssert(t *testing.T) { Assert(t, 1 == 1) Assert(t, 1 == 1, "message1", "message2") } func TestAssertf(t *testing.T) { Assertf(t, 1 == 1, "%v:%v", "message1", "message2") }
See failed test output (assert_failed_test.go):
go test -assert.failed
Report bugs to <chaishushan@gmail.com>.
Thanks!
Index ¶
- func Assert(tb testing.TB, condition bool, args ...interface{})
- func AssertBetween(tb testing.TB, min, max, val float64, args ...interface{})
- func AssertEqual(tb testing.TB, expected, got interface{}, args ...interface{})
- func AssertFalse(tb testing.TB, condition bool, args ...interface{})
- func AssertFileExists(tb testing.TB, path string, args ...interface{})
- func AssertFileNotExists(tb testing.TB, path string, args ...interface{})
- func AssertImageEqual(tb testing.TB, expected, got image.Image, maxDelta color.Color, ...)
- func AssertImplements(tb testing.TB, interfaceObj, obj interface{}, args ...interface{})
- func AssertMapContain(tb testing.TB, m, key, val interface{}, args ...interface{})
- func AssertMapContainKey(tb testing.TB, m, key interface{}, args ...interface{})
- func AssertMapContainVal(tb testing.TB, m, val interface{}, args ...interface{})
- func AssertMapEqual(tb testing.TB, expected, got interface{}, args ...interface{})
- func AssertMapNotContain(tb testing.TB, m, key, val interface{}, args ...interface{})
- func AssertMapNotContainKey(tb testing.TB, m, key interface{}, args ...interface{})
- func AssertMapNotContainVal(tb testing.TB, m, val interface{}, args ...interface{})
- func AssertMatch(tb testing.TB, expectedPattern string, got []byte, args ...interface{})
- func AssertMatchString(tb testing.TB, expectedPattern, got string, args ...interface{})
- func AssertNear(tb testing.TB, expected, got, abs float64, args ...interface{})
- func AssertNil(tb testing.TB, p interface{}, args ...interface{})
- func AssertNotBetween(tb testing.TB, min, max, val float64, args ...interface{})
- func AssertNotEqual(tb testing.TB, expected, got interface{}, args ...interface{})
- func AssertNotNil(tb testing.TB, p interface{}, args ...interface{})
- func AssertNotPanic(tb testing.TB, f func(), args ...interface{})
- func AssertNotZero(tb testing.TB, val interface{}, args ...interface{})
- func AssertPanic(tb testing.TB, f func(), args ...interface{})
- func AssertSameType(tb testing.TB, expectedType interface{}, obj interface{}, args ...interface{})
- func AssertSliceContain(tb testing.TB, slice, val interface{}, args ...interface{})
- func AssertSliceNotContain(tb testing.TB, slice, val interface{}, args ...interface{})
- func AssertTrue(tb testing.TB, condition bool, args ...interface{})
- func AssertZero(tb testing.TB, val interface{}, args ...interface{})
- func Assertf(tb testing.TB, condition bool, format string, a ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertBetween ¶
func AssertEqual ¶
func AssertFalse ¶
func AssertFileExists ¶
func AssertFileNotExists ¶
func AssertImageEqual ¶
func AssertImplements ¶
func AssertMapContain ¶
func AssertMapContainKey ¶
func AssertMapContainVal ¶
func AssertMapEqual ¶
func AssertMapNotContain ¶
func AssertMapNotContainKey ¶
func AssertMapNotContainVal ¶
func AssertMatch ¶
func AssertMatchString ¶
func AssertNear ¶
func AssertNotBetween ¶
func AssertNotEqual ¶
func AssertNotNil ¶
func AssertNotPanic ¶
func AssertNotZero ¶
func AssertPanic ¶
func AssertSameType ¶
func AssertSliceContain ¶
func AssertSliceNotContain ¶
func AssertTrue ¶
func AssertZero ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.