Documentation ¶
Overview ¶
Package ts provides Go packages testing utilities. See https://github.com/qiniu/x/wiki/How-to-write-a-TestCase for details.
Index ¶
- Constants
- func Error(t *testing.T, args ...interface{})
- func Errorf(t *testing.T, format string, args ...interface{})
- func Fatal(t *testing.T, args ...interface{})
- func Fatalf(t *testing.T, format string, args ...interface{})
- func Log(t *testing.T, args ...interface{})
- func Logf(t *testing.T, format string, args ...interface{})
- func PropVal(o reflect.Value, prop string) reflect.Value
- type Expecting
- func (p *Expecting) Call(fn interface{}, args ...interface{}) (e *Expecting)
- func (p *Expecting) Close() error
- func (p *Expecting) Expect(text interface{}) *Expecting
- func (p *Expecting) ExpectErr(text interface{}) *Expecting
- func (p *Expecting) NoPanic()
- func (p *Expecting) Panic(panicMsg ...interface{}) *Expecting
- type Frame
- type TestCase
- func (p *TestCase) Call(fn interface{}, args ...interface{}) (e *TestCase)
- func (p *TestCase) Equal(vals ...interface{}) *TestCase
- func (p *TestCase) Init(result ...interface{}) *TestCase
- func (p *TestCase) Next() *TestCase
- func (p *TestCase) Panic(panicMsg ...interface{}) *TestCase
- func (p *TestCase) PropEqual(prop string, v interface{}) *TestCase
- func (p *TestCase) With(i int) *TestCase
- type Testing
Constants ¶
const ( // CapStdout - capture stdout CapStdout = 1 // CapStderr - capture stderr CapStderr = 2 // CapOutput - capture stdout and stderr CapOutput = CapStdout | CapStderr )
Variables ¶
This section is empty.
Functions ¶
func Log ¶
Log formats its arguments using default formatting, analogous to Print(), and records the text in the error log.
Types ¶
type Expecting ¶ added in v1.10.9
type Expecting struct {
// contains filtered or unexported fields
}
Expecting represents a expecting object.
func StartExpecting ¶ added in v1.10.9
StartExpecting starts expecting with a capture mode.
func (*Expecting) NoPanic ¶ added in v1.11.5
func (p *Expecting) NoPanic()
NoPanic indicates that no panic occurs.
type Frame ¶ added in v1.11.2
type Frame uintptr
Frame represents a program counter inside a stack frame. For historical reasons if Frame is interpreted as a uintptr its value represents the program counter + 1.
type TestCase ¶ added in v1.10.6
type TestCase struct {
// contains filtered or unexported fields
}
TestCase represents a test case.
func (*TestCase) Panic ¶ added in v1.10.9
Panic checks if function call panics or not. Panic() means the function call doesn't panic at all, and Panic(v) means function call panics with `v`. If v == nil, it means we don't care any detail information about panic.
type Testing ¶ added in v1.10.6
type Testing struct {
// contains filtered or unexported fields
}
Testing represents a testing object.
func (*Testing) Call ¶ added in v1.10.6
Call creates a test case without name, and calls a function.
func (*Testing) Case ¶ added in v1.10.6
Case creates a test case with name and sets its output parameters.