got

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2020 License: MIT Imports: 7 Imported by: 8

README

Overview

A tiny test framework for go projects. The test of this lib is its doc.

All functions in this lib are side-effect free.

Examples

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Each added in v0.0.3

func Each(t Testable, iteratee interface{}) (count int)

Each runs each exported method Fn on type Ctx as a subtest of t. The iteratee can be a struct Ctx or:

iteratee(t Testable) (ctx Ctx)

Each Fn will be called like:

ctx.Fn()

If iteratee is Ctx, its Assertion and T fields will be set to New(t) and t for each test. Any Fn that has the same name with the embedded one will be ignored.

Types

type Assertion added in v0.0.3

type Assertion struct {
	Testable
}

Assertion is the assertion context

func New added in v0.0.3

func New(t Testable) Assertion

New assertion helper

func (Assertion) Eq added in v0.0.3

func (as Assertion) Eq(a, b interface{})

Eq a == b

func (Assertion) Err added in v0.0.3

func (as Assertion) Err(args ...interface{})

Err args[-1] is error and not nil

func (Assertion) False added in v0.0.3

func (as Assertion) False(a bool)

False a == false

func (Assertion) Gt added in v0.0.3

func (as Assertion) Gt(a, b interface{})

Gt a > b

func (Assertion) Gte added in v0.0.3

func (as Assertion) Gte(a, b interface{})

Gte a >= b

func (Assertion) Has added in v0.0.3

func (as Assertion) Has(container, str string)

Has str in container

func (Assertion) Is added in v0.0.3

func (as Assertion) Is(a, b interface{})

Is a a kind of b

func (Assertion) Len added in v0.0.3

func (as Assertion) Len(list interface{}, l int)

Len len(list) == l

func (Assertion) Lt added in v0.0.3

func (as Assertion) Lt(a, b interface{})

Lt a < b

func (Assertion) Lte added in v0.0.3

func (as Assertion) Lte(a, b interface{})

Lte a <= b

func (Assertion) Neq added in v0.0.3

func (as Assertion) Neq(a, b interface{})

Neq a != b

func (Assertion) Nil added in v0.0.3

func (as Assertion) Nil(args ...interface{})

Nil args[-1] == nil

func (Assertion) NotNil added in v0.0.3

func (as Assertion) NotNil(args ...interface{})

NotNil args[-1] != nil

func (Assertion) Panic added in v0.0.3

func (as Assertion) Panic(fn func())

Panic fn should panic

func (Assertion) Regex added in v0.0.3

func (as Assertion) Regex(pattern, str string)

Regex matches str

func (Assertion) True added in v0.0.3

func (as Assertion) True(a bool)

True a == true

type Testable added in v0.0.3

type Testable interface {
	Helper()
	Fail()
	FailNow()
	Logf(format string, args ...interface{})
}

Testable interface

Directories

Path Synopsis
lib
benchmark Module
example Module

Jump to

Keyboard shortcuts

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