Documentation
¶
Overview ¶
Package unassert provides assertions based on the provided build tags. Using -tags unassert_panics panics if an assertion fails. Using -tags unassert_stderr prints an error to stdout if an assertion fails.
Index ¶
- func Error(format string, v ...interface{})
- func False(b bool)
- func Falsef(b bool, format string, v ...interface{})
- func Matches(predicate Predicate, x interface{})
- func Matchesf(predicate Predicate, x interface{}, format string, v ...interface{})
- func Nil(o interface{})
- func Nilf(o interface{}, format string, v ...interface{})
- func NotNil(o interface{})
- func NotNilf(o interface{}, format string, v ...interface{})
- func NotSame(a interface{}, b interface{})
- func NotSamef(a interface{}, b interface{}, format string, v ...interface{})
- func ReturnsTrue(evaluator Evaluator)
- func ReturnsTruef(evaluator Evaluator, format string, v ...interface{})
- func Same(a interface{}, b interface{})
- func Samef(a interface{}, b interface{}, format string, v ...interface{})
- func True(b bool)
- func Truef(b bool, format string, v ...interface{})
- type ErrorHandler
- type Evaluator
- type Predicate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Error ¶ added in v0.1.1
func Error(format string, v ...interface{})
Error promotes an error according to 'unassert_' build tags. Formats according to a format specifier.
func False ¶ added in v0.1.2
func False(b bool)
False checks if b is false. Behaves according to 'unassert_' build tags.
func Falsef ¶ added in v0.1.2
Falsef checks if b is false. Behaves according to 'unassert_' build tags. Formats according to a format specifier.
func Matches ¶ added in v0.1.3
func Matches(predicate Predicate, x interface{})
Matches checks if predicate(v) is true. Useful for lazy evaluation of complex assertions. Behaves according to 'unassert_' build tags. Formats according to a format specifier.
func Matchesf ¶ added in v0.1.3
Matchesf checks if predicate(v) is true. Useful for lazy evaluation of complex assertions. Behaves according to 'unassert_' build tags. Formats according to a format specifier.
func Nil ¶ added in v0.1.1
func Nil(o interface{})
Nil checks if v is nil. Behaves according to 'unassert_' build tags.
func Nilf ¶ added in v0.1.1
func Nilf(o interface{}, format string, v ...interface{})
Nilf checks if v is nil. Behaves according to 'unassert_' build tags. Formats according to a format specifier.
func NotNil ¶ added in v0.1.1
func NotNil(o interface{})
NotNil checks if v is not nil. Behaves according to 'unassert_' build tags.
func NotNilf ¶ added in v0.1.1
func NotNilf(o interface{}, format string, v ...interface{})
NotNilf checks if v is not nil. Behaves according to 'unassert_' build tags. Formats according to a format specifier.
func NotSame ¶ added in v0.1.2
func NotSame(a interface{}, b interface{})
NotSame checks if a != b. Behaves according to 'unassert_' build tags.
func NotSamef ¶ added in v0.1.2
func NotSamef(a interface{}, b interface{}, format string, v ...interface{})
NotSamef checks if a != b. Behaves according to 'unassert_' build tags. Formats according to a format specifier.
func ReturnsTrue ¶ added in v0.1.3
func ReturnsTrue(evaluator Evaluator)
ReturnsTrue checks if evaluator() returns true. Useful for lazy evaluation of complex assertions. Behaves according to 'unassert_' build tags. Formats according to a format specifier.
func ReturnsTruef ¶ added in v0.1.3
ReturnsTrue checks if evaluator() returns true. Useful for lazy evaluation of complex assertions. Behaves according to 'unassert_' build tags. Formats according to a format specifier.
func Same ¶
func Same(a interface{}, b interface{})
Same checks if a == b. Behaves according to 'unassert_' build tags.
func Samef ¶ added in v0.1.1
func Samef(a interface{}, b interface{}, format string, v ...interface{})
Samef checks if a == b. Behaves according to 'unassert_' build tags. Formats according to a format specifier.
Types ¶
type ErrorHandler ¶ added in v0.1.1
type ErrorHandler func(format string, v ...interface{})
ErrorHandler handles an error. See unassert_panic & unassert_stderr
Directories
¶
| Path | Synopsis |
|---|---|
|
Package dopanic implements unassert.ErrorHandler by panicking.
|
Package dopanic implements unassert.ErrorHandler by panicking. |
|
Package stderr implements unassert.ErrorHandler by printing to stderr.
|
Package stderr implements unassert.ErrorHandler by printing to stderr. |