package
Version:
v1.1.0-rc1
Opens a new window with list of versions in this module.
Published: Oct 22, 2021
License: Apache-2.0
Opens a new window with license information.
Imports: 8
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
assert
提供了一些常用的断言函数。
方法列表
| 方法名 |
功能 |
| True |
asserts that got is true. |
| False |
asserts that got is false. |
| Nil |
asserts that got is nil. |
| NotNil |
asserts that got is not nil. |
| Equal |
asserts that got and expect are equal. |
| NotEqual |
asserts that got and expect are not equal. |
| Panic |
asserts that function would panic. |
| Matches |
asserts that a got value matches a given regular expression. |
| Error |
asserts that a got error string matches a given regular expression. |
Documentation
¶
Package assert 提供了一些常用的断言函数。
-
func Check(cases Cases) error
-
func Equal(t *testing.T, got interface{}, expect interface{})
-
func Error(t *testing.T, got error, expr string)
-
func False(t *testing.T, got bool)
-
func Matches(t *testing.T, got string, expr string)
-
func Nil(t *testing.T, got interface{})
-
func NotEqual(t *testing.T, got interface{}, expect interface{})
-
func NotNil(t *testing.T, got interface{})
-
func Panic(t *testing.T, fn func(), expr string)
-
func True(t *testing.T, got bool)
-
type Cases
func Equal(t *testing.T, got interface{}, expect interface{})
Equal asserts that got and expect are equal.
Error asserts that a got error string matches a given regular expression.
False asserts that got is false.
Matches asserts that a got value matches a given regular expression.
Nil asserts that got is nil.
func NotEqual(t *testing.T, got interface{}, expect interface{})
NotEqual asserts that got and expect are not equal.
func NotNil(t *testing.T, got interface{})
NotNil asserts that got is not nil.
Panic asserts that function fn() would panic. It fails if the panic
message does not match the regular expression.
True asserts that got is true.
type Cases = []struct {
Condition bool
Message string
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.