test

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertContentType

func AssertContentType(t *testing.T, response *httptest.ResponseRecorder, want string)

AssertContentType 比对 respose content-type 是否一致

func AssertDeepEqual

func AssertDeepEqual(t *testing.T, got, want interface{})

AssertDeepEqual 使用 reflect.DeepEqual 比对两个任意类型是否相等

func AssertEquals

func AssertEquals(t *testing.T, got, want interface{})

AssertEquals 比对两个基本类型是否相等

func AssertNoError

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

AssertNoError 检查如果 err 则退出测试

func AssertWebsocketGotMsg

func AssertWebsocketGotMsg(t *testing.T, ws *websocket.Conn, want string)

AssertWebsocketGotMsg 比对从 ws 中读取的信息是否与 want 相等

func CreateTempFile

func CreateTempFile(t *testing.T, initialData string, filename string) (*os.File, func())

CreateTempFile 创建临时文件, 返回文件关闭函数句柄

func RetryUntil

func RetryUntil(t *testing.T, d time.Duration, assert func() bool) bool

RetryUntil 在指定时间内, 重复执行 assert 函数, 如果成果返回 true, 否则测试失败

func Within

func Within(t testing.TB, d time.Duration, assert func())

Within 在指定时间 d 内, 完成 assert 函数, 否则返回测试错误

Types

This section is empty.

Jump to

Keyboard shortcuts

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