testing2

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2015 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package test is a wrapper of testing that supply some useful functions for test.

Index

Constants

This section is empty.

Variables

View Source
var NoCheck = struct{}{}

NoCheck means don't check this value

View Source
var NonNil = struct{}{}

NonNil means this value should not be nil

Functions

func Recover

func Recover(t testing.TB)

Recover catch a panic and log it

func RecoverEq

func RecoverEq(t testing.TB, s string)

Recover catch a panic and log it

Types

type TB

type TB struct {
	testing.TB
}

TB is a wrapper of testing.testing.TB

func DeepEq

func DeepEq(t testing.TB, expect, got interface{}) TB

DeepEq assert expect and got is deep-equal, else print error message

func Eq

func Eq(t testing.TB, expect, got interface{}) TB

Eq assert expect and got is equal, else print error message

func False

func False(t testing.TB, val bool) TB

False assert val is false

func NE

func NE(t testing.TB, expect, got interface{}) TB

NE assert expect and got is not equal, else print error message

func NNil

func NNil(t testing.TB, val interface{}) TB

func Nil

func Nil(t testing.TB, val interface{}) TB

func True

func True(t testing.TB, val bool) TB

True assert val is true

func Wrap

func Wrap(t testing.TB) TB

Wrap testing.testing.TB or testing.B to TB

func (TB) DeepEq

func (t TB) DeepEq(expect, got interface{}) TB

DeepEq assert expect and got is deep-equal, else print error message

func (TB) Eq

func (t TB) Eq(expect, got interface{}) TB

Eq assert expect and got is equal, else print error message

func (TB) False

func (t TB) False(val bool) TB

False assert val is false

func (TB) NE

func (t TB) NE(expect, got interface{}) TB

NE assert expect and got is not equal, else print error message

func (TB) NNil

func (t TB) NNil(val interface{}) TB

func (TB) Nil

func (t TB) Nil(val interface{}) TB

func (TB) Recover

func (t TB) Recover() TB

Recover catch a panic and log it

func (TB) RecoverEq

func (t TB) RecoverEq(s string) TB

Recover catch a panic and log it

func (TB) True

func (t TB) True(val bool) TB

True assert val is true

type TestCase

type TestCase struct {
	// contains filtered or unexported fields
}

func Expect

func Expect(expect ...interface{}) *TestCase

func Tests

func Tests() *TestCase

func (*TestCase) Arg

func (test *TestCase) Arg(args ...interface{}) *TestCase

func (*TestCase) Expect

func (test *TestCase) Expect(expect ...interface{}) *TestCase

func (*TestCase) False

func (test *TestCase) False() *TestCase

func (*TestCase) Nil

func (test *TestCase) Nil() *TestCase

func (*TestCase) Run

func (test *TestCase) Run(t testing.TB, fn ...interface{}) *TestCase

func (*TestCase) True

func (test *TestCase) True() *TestCase

Jump to

Keyboard shortcuts

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