assert

package
v0.30.7 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2022 License: MIT Imports: 1 Imported by: 6

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)

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

Types

type TestingT

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

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

Jump to

Keyboard shortcuts

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