assert

package
v1.1.0-alpha Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package assert 提供了一些断言函数。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(cases Cases) error

Check 用于检查参数有效性。

func Equal

func Equal(t *testing.T, got interface{}, expect interface{})

Equal asserts that got and expect are equal as defined by reflect.DeepEqual.

func Error

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

Error asserts that a got error string matches a given regular expression.

func False

func False(t *testing.T, got bool)

False asserts that got is false.

func Matches

func Matches(t *testing.T, got string, expr string)

Matches asserts that a got value matches a given regular expression.

func Nil

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

Nil asserts that got is nil.

func NotEqual

func NotEqual(t *testing.T, got interface{}, expect interface{})

NotEqual asserts that got and expect are not equal as defined by reflect.DeepEqual.

func NotNil

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

NotNil asserts that got is not nil.

func Panic

func Panic(t *testing.T, fn func(), expr string)

Panic asserts that function fn() would panic. It fails if the panic message does not match the regular expression.

func True

func True(t *testing.T, got bool)

True asserts that got is true.

Types

type Cases

type Cases = []struct {
	Condition bool
	Message   string
}

Jump to

Keyboard shortcuts

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