Documentation ¶
Index ¶
- Constants
- Variables
- func BM(b *testing.B, fn func())
- func Blue(message string) string
- func Bold(message string) string
- func Bool(t TestingT, actual interface{}, args ...interface{}) bool
- func CallerInfo() (callers []string)
- func DEqual(t TestingT, expect, actual interface{}, args ...interface{}) bool
- func Drop(api, use string, info ...string) bool
- func Empty(t TestingT, actual interface{}, args ...interface{}) bool
- func Equal(t TestingT, expect, actual interface{}, args ...interface{}) bool
- func Err(s string, v ...interface{}) error
- func Error(t TestingT, actual interface{}, args ...interface{}) bool
- func Expect(t TestingT, expect string, actual interface{}, args ...interface{}) bool
- func False(t TestingT, actual interface{}, args ...interface{}) bool
- func Fmt(equal, expect string, call int, info ...string) (err string)
- func FmtErr(call int, info ...string) string
- func IsType(t TestingT, expect string, actual interface{}, args ...interface{}) bool
- func IsTypes(expect string, actual interface{}) bool
- func Log(s string, v ...interface{}) error
- func Nil(t TestingT, actual interface{}, args ...interface{}) bool
- func Not(t TestingT, expect, actual interface{}, args ...interface{}) bool
- func NotEmpty(t TestingT, actual interface{}, args ...interface{}) bool
- func NotEqual(t TestingT, expect, actual interface{}, args ...interface{}) bool
- func NotErr(call int, info ...string) string
- func NotExpect(t TestingT, expect string, actual interface{}, args ...interface{}) bool
- func NotNil(t TestingT, actual interface{}, args ...interface{}) bool
- func NotZero(t TestingT, actual interface{}, args ...interface{}) bool
- func Pprof(tm ...int) bool
- func Red(message string) string
- func RedBold(message string) string
- func True(t TestingT, actual interface{}, args ...interface{}) bool
- func TypeF()
- func TypeOf(expect, actual interface{}) bool
- func UnUsed(v string, info ...string) bool
- func Yellow(message string) string
- func Zero(t TestingT, actual interface{}, args ...interface{}) bool
- type Assertions
- func (at *Assertions) BM(b *testing.B, fn func())
- func (at *Assertions) Bool(actual interface{}, args ...interface{}) bool
- func (at *Assertions) Empty(actual interface{}, args ...interface{}) bool
- func (at *Assertions) Equal(expect, actual interface{}, args ...interface{}) bool
- func (at *Assertions) Error(actual interface{}, args ...interface{}) bool
- func (at *Assertions) Expect(expect string, actual interface{}, args ...interface{}) bool
- func (at *Assertions) False(actual interface{}, args ...interface{}) bool
- func (at *Assertions) IsType(expect string, actual interface{}, args ...interface{}) bool
- func (at *Assertions) Nil(actual interface{}, args ...interface{}) bool
- func (at *Assertions) Not(expect, actual interface{}, args ...interface{}) bool
- func (at Assertions) NotEmpty(actual interface{}, args ...interface{}) bool
- func (at *Assertions) NotEqual(expect, actual interface{}, args ...interface{}) bool
- func (at *Assertions) NotExpect(expect string, actual interface{}, args ...interface{}) bool
- func (at *Assertions) NotNil(actual interface{}, args ...interface{}) bool
- func (at *Assertions) NotZero(actual interface{}, args ...interface{}) bool
- func (at *Assertions) True(actual interface{}, args ...interface{}) bool
- func (at *Assertions) Zero(actual interface{}, args ...interface{}) bool
- type TestingT
Constants ¶
const (
// Version get the tt version
Version = "v0.20.0.77, Sierra Nevada!"
)
Variables ¶
var ( // Type type must Type bool )
Functions ¶
func CallerInfo ¶
func CallerInfo() (callers []string)
CallerInfo returns an array of strings containing the file and line number, and each stack frame leading from the current test, when the assert call that failed.
func NotExpect ¶
NotExpect asserts that string and objects are not equal.
tt.NotExpect(t *testing.T, "1", 1)
func Pprof ¶
Pprof use: Mem: pprof -http=:8090 http://127.0.0.1:6060/debug/pprof/heap
go tool pprof http://localhost:6060/debug/pprof/heap
CPU:
debug/pprof/profile
set time:
debug/pprof/profile\?seconds\=10
pprof -http=:8090 http://127.0.0.1:6060/debug/pprof/profile\?seconds\=10
debug/pprof/block debug/pprof/mutex
Types ¶
type Assertions ¶
type Assertions struct {
// contains filtered or unexported fields
}
Assertions provides assertion methods around the TestingT interface.
func New ¶
func New(t TestingT) *Assertions
New makes a new Assertions object for the specified TestingT.
func (*Assertions) BM ¶
func (at *Assertions) BM(b *testing.B, fn func())
BM is the encapsulation of the benchmark function
func Benchmark1(b *testing.B, fn func())
func (*Assertions) Bool ¶
func (at *Assertions) Bool(actual interface{}, args ...interface{}) bool
Bool asserts that true and objects are equal.
func (*Assertions) Empty ¶
func (at *Assertions) Empty(actual interface{}, args ...interface{}) bool
Empty asserts that empty and objects are equal.
func (*Assertions) Equal ¶
func (at *Assertions) Equal(expect, actual interface{}, args ...interface{}) bool
Equal asserts that two objects are equal.
func (*Assertions) Error ¶
func (at *Assertions) Error(actual interface{}, args ...interface{}) bool
Error asserts that not equal error.
at.Error(t *testing.T, err)
func (*Assertions) Expect ¶
func (at *Assertions) Expect(expect string, actual interface{}, args ...interface{}) bool
Expect asserts that string and objects are equal.
func (*Assertions) False ¶
func (at *Assertions) False(actual interface{}, args ...interface{}) bool
False asserts that flase and objects are equal.
func (*Assertions) IsType ¶
func (at *Assertions) IsType(expect string, actual interface{}, args ...interface{}) bool
IsType asserts that two objects type are equal
func (*Assertions) Nil ¶
func (at *Assertions) Nil(actual interface{}, args ...interface{}) bool
Nil asserts that nil and objects are equal.
func (*Assertions) Not ¶
func (at *Assertions) Not(expect, actual interface{}, args ...interface{}) bool
Not asserts that two objects are not equal.
func (Assertions) NotEmpty ¶
func (at Assertions) NotEmpty(actual interface{}, args ...interface{}) bool
NotEmpty asserts that empty and objects are not equal.
func (*Assertions) NotEqual ¶
func (at *Assertions) NotEqual(expect, actual interface{}, args ...interface{}) bool
NotEqual asserts that two objects are not equal.
func (*Assertions) NotExpect ¶
func (at *Assertions) NotExpect(expect string, actual interface{}, args ...interface{}) bool
NotExpect asserts that string and objects are not equal.
func (*Assertions) NotNil ¶
func (at *Assertions) NotNil(actual interface{}, args ...interface{}) bool
NotNil asserts that not equal nil.
at.NotNil(t *testing.T, 1)
func (*Assertions) NotZero ¶
func (at *Assertions) NotZero(actual interface{}, args ...interface{}) bool
NotZero asserts that zero and objects are not equal.
func (*Assertions) True ¶
func (at *Assertions) True(actual interface{}, args ...interface{}) bool
True asserts that true and objects are equal.
func (*Assertions) Zero ¶
func (at *Assertions) Zero(actual interface{}, args ...interface{}) bool
Zero asserts that zero and objects are equal.