assert

package
v0.17.1-0...-36a5d2c Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

package assert 提供了单元测试时的断言功能,减少一些模板代码

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Equal

func Equal(t TestingT, expected interface{}, actual interface{}, msg ...string)

func IsNotNil

func IsNotNil(t TestingT, actual interface{}, msg ...string)

比如有时我们需要对 error 类型不等于 nil 做断言,但是我们并不关心 error 的具体值是什么

Types

type TestingT

type TestingT interface {
	Errorf(format string, args ...interface{})
}

单元测试中的 *testing.T 和 *testing.B 都满足该接口

Jump to

Keyboard shortcuts

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