Documentation
¶
Overview ¶
Package assert implements common assertions used in go-httbin's unit tests.
Index ¶
- func BodyContains(t *testing.T, resp *http.Response, needle string)
- func BodyEquals(t *testing.T, resp *http.Response, want string)
- func BodySize(t *testing.T, resp *http.Response, want int)
- func Contains(t *testing.T, s string, needle string, description string)
- func ContentType(t *testing.T, resp *http.Response, contentType string)
- func DeepEqual[T any](t *testing.T, got, want T, msg string, arg ...any)
- func DurationRange(t *testing.T, got, minVal, maxVal time.Duration)
- func Equal[T comparable](t *testing.T, got, want T, msg string, arg ...any)
- func Error(t *testing.T, got, expected error)
- func Header(t *testing.T, resp *http.Response, key, want string)
- func NilError(t *testing.T, err error)
- func RoughlyEqual[T number](t *testing.T, got, want T, epsilon T)
- func StatusCode(t *testing.T, 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.T, got, want T, msg string, arg ...any)
Equal asserts that two values are equal.
func RoughlyEqual ¶ added in v2.13.2
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.