Documentation
¶
Overview ¶
Package assert implements common assertions used in go-httbin's unit tests.
Index ¶
- func BodyContains(t testing.TB, resp *http.Response, needle string)
- func BodyEquals(t testing.TB, resp *http.Response, want string)
- func BodySize(t testing.TB, resp *http.Response, want int)
- func Contains(t testing.TB, s string, needle string, description string)
- func ContentType(t testing.TB, resp *http.Response, contentType string)
- func DeepEqual[T any](t testing.TB, got, want T, msg string, arg ...any)
- func DurationRange(t testing.TB, got, minVal, maxVal time.Duration)
- func Equal[T comparable](t testing.TB, got, want T, msg string, arg ...any)
- func Error(t testing.TB, got, expected error, alternates ...error)
- func Header(t testing.TB, resp *http.Response, key, want string)
- func NilError(t testing.TB, err error)
- func RoughlyEqual[T number](t testing.TB, got, want T, epsilon T)
- func StatusCode(t testing.TB, resp *http.Response, code int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BodyContains ¶
BodyContains asserts that a response body contains a specific substring.
func BodyEquals ¶
BodyEquals asserts that a response body is equal to a specific string.
func ContentType ¶
ContentType asserts that a response has a specific Content-Type header value.
func DurationRange ¶
DurationRange asserts that a duration is within a specific range.
func Equal ¶
func Equal[T comparable](t testing.TB, got, want T, msg string, arg ...any)
Equal asserts that two values are equal.
func Error ¶
Error asserts that an error matches an expected error or any one of a list of expected errors.
func RoughlyEqual ¶
RoughlyEqual asserts that a numeric value is within a certain tolerance.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.