Documentation ¶
Overview ¶
Package ftest is a simple easy to use testing library. It prints only the exact location of failed test (without scary stack trace). It uses a fluent desing. It stops a test on the first failure
ftest.New(t).Eq(2, 2). Contains("FooBarBaz", "Bar"). PanicsSubstr(func() { panic("Foo") }, "Foo")
Also to make testing simpler, this package performs extra nil checks, so nil, non initialized slice and empty pointer - all will be considered equal (and that's what you are expecting)
Index ¶
- type Assertion
- func (ass *Assertion) Contains(str, substr string) *Assertion
- func (ass *Assertion) Containsf(str, substr, format string, args ...interface{}) *Assertion
- func (ass *Assertion) Eq(got, expected interface{}) *Assertion
- func (ass *Assertion) Eqf(got, expected interface{}, format string, args ...interface{}) *Assertion
- func (ass *Assertion) False(got bool) *Assertion
- func (ass *Assertion) Falsef(got bool, format string, args ...interface{}) *Assertion
- func (ass *Assertion) Nil(got interface{}) *Assertion
- func (ass *Assertion) Nilf(got interface{}, format string, args ...interface{}) *Assertion
- func (ass *Assertion) NotEq(got, expected interface{}) *Assertion
- func (ass *Assertion) NotEqf(got, expected interface{}, format string, args ...interface{}) *Assertion
- func (ass *Assertion) NotNil(got interface{}) *Assertion
- func (ass *Assertion) NotNilf(got interface{}, format string, args ...interface{}) *Assertion
- func (ass *Assertion) PanicsSubstr(fn func(), substr string) (ret *Assertion)
- func (ass *Assertion) True(got bool) *Assertion
- func (ass *Assertion) Truef(got bool, format string, args ...interface{}) *Assertion
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Assertion ¶
type Assertion struct {
// contains filtered or unexported fields
}
Assertion represents an assertion which holds current a *testing.T object
func (*Assertion) NotEqf ¶
func (ass *Assertion) NotEqf(got, expected interface{}, format string, args ...interface{}) *Assertion
NotEqf is an f version of NotEq
func (*Assertion) PanicsSubstr ¶
PanicsSubstr tests if a given function causes and panic and an error contains given substring. You can pass an empty string("") if the error doesn't matter