assert

package
v2.11.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 6, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BodyContains

func BodyContains(t *testing.T, resp *http.Response, needle string)

BodyContains asserts that a response body contains a specific substring.

func BodyEquals

func BodyEquals(t *testing.T, resp *http.Response, want string)

BodyEquals asserts that a response body is equal to a specific string.

func BodySize

func BodySize(t *testing.T, resp *http.Response, want int)

BodySize asserts that a response body is a specific size.

func ContentType

func ContentType(t *testing.T, resp *http.Response, contentType string)

ContentType asserts that a response has a specific Content-Type header value.

func DeepEqual

func DeepEqual[T any](t *testing.T, got, want T, msg string, arg ...any)

DeepEqual asserts that two values are deeply equal.

func DurationRange

func DurationRange(t *testing.T, got, min, max time.Duration)

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 Error

func Error(t *testing.T, got, expected error)

Error asserts that an error is not nil.

func Header(t *testing.T, resp *http.Response, key, want string)

Header asserts that a header key has a specific value in a response.

func NilError

func NilError(t *testing.T, err error)

NilError asserts that an error is nil.

func RoughDuration

func RoughDuration(t *testing.T, got, want time.Duration, tolerance time.Duration)

RoughDuration asserts that a duration is within a certain tolerance of a given value.

func StatusCode

func StatusCode(t *testing.T, resp *http.Response, code int)

StatusCode asserts that a response has a specific status code.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL