want

package module
v0.0.0-...-a28b0fa Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2014 License: BSD-2-Clause Imports: 4 Imported by: 0

README

testing-want

Simple, Easliy for golang testing

want 是个简洁并易于使用的辅助测试包. 请直接查看 godoc 文档.

GoDoc

The documentation is available at gowalker.org.

Import

import "github.com/achun/testing-want"

License

BSD-2-Clause

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LocalFileLine bool

Functions

func Caller

func Caller(skip int) string

returns filepath and line by runtime

func Equal

func Equal(t *testing.T, got, wants interface{}, show ...interface{})

want got equal wants

func Error

func Error(t *testing.T, err error, show ...interface{})

wants an error, if nil Fatal

func False

func False(t *testing.T, ok bool, show ...interface{})

want ok equal false

func LastError

func LastError(rets ...interface{}) error

return last argument.(error)

func Nil

func Nil(t *testing.T, v interface{}, show ...interface{})

want v as nil, if not nil Fatal

func NotNil

func NotNil(t *testing.T, v interface{}, show ...interface{})

want v not nil, if not nil Fatal

func Panic

func Panic(t *testing.T, fn func())

want recover panic, if nil Fatal

func Printf

func Printf(format string, i ...interface{})

func Println

func Println(i ...interface{})

func Recover

func Recover(t *testing.T, msg string, fn func())

want recover msg string

func String

func String(show ...interface{}) string

returns string by fmt.Sprint. if not empty, prefix "\n"

func True

func True(t *testing.T, ok bool, show ...interface{})

want ok equal true

Types

type Want

type Want struct {
	T    testing.TB
	Skip int
}

func T

func T(t testing.TB) Want

func (Want) Equal

func (w Want) Equal(got, wants interface{}, show ...interface{}) Want

func (Want) Error

func (w Want) Error(err error, show ...interface{}) Want

func (Want) False

func (w Want) False(ok bool, show ...interface{}) Want

func (Want) Fatal

func (w Want) Fatal(show ...interface{})

func (Want) Fatalf

func (w Want) Fatalf(format string, show ...interface{})

func (Want) Nil

func (w Want) Nil(i interface{}, show ...interface{}) Want

func (Want) NotNil

func (w Want) NotNil(i interface{}, show ...interface{}) Want

func (Want) Panic

func (w Want) Panic(fn func()) Want

func (Want) Recover

func (w Want) Recover(msg string, fn func()) Want

func (Want) True

func (w Want) True(ok bool, show ...interface{}) Want

Jump to

Keyboard shortcuts

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