assert

package module
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2015 License: MIT Imports: 9 Imported by: 0

README

assertgo

Build Status Coverage Status GoDoc

The coolest assertion library for go language!

Version: 2.0.0

Getting started

To get the package, execute:

go get github.com/assertgo/assert

To import this package, add the following line to your code:

import "github.com/assertgo/assert"

And just start using it.

func TestPerfectNumber(t *testing.T) {
	assert := assert.New(t)
	num := ComputePerfectNumber()
	assert.ThatInt(num).
		IsEqualTo(6).
		IsNonZero().
		IsPositive().
		IsNonNegative().
		IsEven().
		IsDivisibleBy(3).
		IsBetween(4, 10).
		IsIn(496, 28, 6).
		IsNotIn(2, 3, 5, 7, 11, 13)
}

Stating what you expect was never that easy.

Contibuting

Please see CONTRIBUTING.md.

License

assertgo is a free software and may be used under the terms specified in the LICENSE file.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnyType

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

func (*AnyType) AsBool

func (a *AnyType) AsBool() *Bool

func (*AnyType) AsComplex

func (a *AnyType) AsComplex() *Complex

func (*AnyType) AsFloat

func (a *AnyType) AsFloat() *Float

func (*AnyType) AsInt

func (a *AnyType) AsInt() *Int

func (*AnyType) AsInt64

func (a *AnyType) AsInt64() *Int64

func (*AnyType) AsString

func (a *AnyType) AsString() *String

func (*AnyType) AsUint64

func (a *AnyType) AsUint64() *Uint64

func (*AnyType) IsEqualTo

func (a *AnyType) IsEqualTo(expected interface{}) *AnyType

func (*AnyType) IsNil

func (a *AnyType) IsNil() *AnyType

func (*AnyType) IsNotEqualTo

func (a *AnyType) IsNotEqualTo(expected interface{}) *AnyType

func (*AnyType) IsNotNil

func (a *AnyType) IsNotNil() *AnyType

type Bool

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

func (*Bool) IsFalse

func (a *Bool) IsFalse() *Bool

func (*Bool) IsSchrödingersCat

func (a *Bool) IsSchrödingersCat() *Bool

func (*Bool) IsTrue

func (a *Bool) IsTrue() *Bool

type Complex

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

func (*Complex) IsEqualTo

func (a *Complex) IsEqualTo(expected complex128) *Complex

func (*Complex) IsNonZero

func (a *Complex) IsNonZero() *Complex

func (*Complex) IsNotEqualTo

func (a *Complex) IsNotEqualTo(unexpected complex128) *Complex

func (*Complex) IsZero

func (a *Complex) IsZero() *Complex

type Float

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

func (*Float) IsNonZero

func (a *Float) IsNonZero() *Float

func (*Float) IsZero

func (a *Float) IsZero() *Float

type Int

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

func (*Int) IsAnswerToTheUltimateQuestionOfLife

func (a *Int) IsAnswerToTheUltimateQuestionOfLife() *Int

func (*Int) IsBetween

func (a *Int) IsBetween(lowerBound, upperBound int) *Int

func (*Int) IsDivisibleBy

func (a *Int) IsDivisibleBy(divisor int) *Int

func (*Int) IsEqualTo

func (a *Int) IsEqualTo(expected int) *Int

func (*Int) IsEven

func (a *Int) IsEven() *Int

func (*Int) IsGreaterOrEqualTo

func (a *Int) IsGreaterOrEqualTo(lessOrEqual int) *Int

func (*Int) IsGreaterThan

func (a *Int) IsGreaterThan(less int) *Int

func (*Int) IsIn

func (a *Int) IsIn(elements ...int) *Int

func (*Int) IsLessOrEqualTo

func (a *Int) IsLessOrEqualTo(greaterOrEqual int) *Int

func (*Int) IsLessThan

func (a *Int) IsLessThan(greater int) *Int

func (*Int) IsNegative

func (a *Int) IsNegative() *Int

func (*Int) IsNonNegative

func (a *Int) IsNonNegative() *Int

func (*Int) IsNonPositive

func (a *Int) IsNonPositive() *Int

func (*Int) IsNonZero

func (a *Int) IsNonZero() *Int

func (*Int) IsNotBetween

func (a *Int) IsNotBetween(lowerBound, upperBound int) *Int

func (*Int) IsNotDivisibleBy

func (a *Int) IsNotDivisibleBy(divisor int) *Int

func (*Int) IsNotEqualTo

func (a *Int) IsNotEqualTo(unexpected int) *Int

func (*Int) IsNotIn

func (a *Int) IsNotIn(elements ...int) *Int

func (*Int) IsNotPrime

func (a *Int) IsNotPrime() *Int

func (*Int) IsOdd

func (a *Int) IsOdd() *Int

func (*Int) IsPositive

func (a *Int) IsPositive() *Int

func (*Int) IsPrime

func (a *Int) IsPrime() *Int

func (*Int) IsZero

func (a *Int) IsZero() *Int

type Int64

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

func (*Int64) IsNonZero

func (a *Int64) IsNonZero() *Int64

func (*Int64) IsZero

func (a *Int64) IsZero() *Int64

type Provider

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

func New

func New(t *testing.T) *Provider

func (*Provider) That

func (p *Provider) That(actual interface{}) *AnyType

func (*Provider) ThatBool

func (p *Provider) ThatBool(actual bool) *Bool

func (*Provider) ThatComplex

func (p *Provider) ThatComplex(actual complex128) *Complex

func (*Provider) ThatFloat

func (p *Provider) ThatFloat(actual float64) *Float

func (*Provider) ThatInt

func (p *Provider) ThatInt(actual int) *Int

func (*Provider) ThatInt64

func (p *Provider) ThatInt64(actual int64) *Int64

func (*Provider) ThatString

func (p *Provider) ThatString(actual string) *String

func (*Provider) ThatUint64

func (p *Provider) ThatUint64(actual uint64) *Uint64

type String

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

func (*String) Contains

func (a *String) Contains(substring string) *String

func (*String) DoesNotContain

func (a *String) DoesNotContain(substring string) *String

func (*String) IsEmpty

func (a *String) IsEmpty() *String

func (*String) IsEqualTo

func (a *String) IsEqualTo(expected string) *String

func (*String) IsInSlice

func (a *String) IsInSlice(expectedSlice []string) *String

func (*String) IsLowerCase

func (a *String) IsLowerCase() *String

func (*String) IsNotEmpty

func (a *String) IsNotEmpty() *String

func (*String) IsNotEqualTo

func (a *String) IsNotEqualTo(unexpected string) *String

func (*String) IsNotInSlice

func (a *String) IsNotInSlice(expectedSlice []string) *String

func (*String) IsNotLowerCase

func (a *String) IsNotLowerCase() *String

func (*String) IsNotUpperCase

func (a *String) IsNotUpperCase() *String

func (*String) IsUpperCase

func (a *String) IsUpperCase() *String

func (*String) Matches

func (a *String) Matches(pattern string) *String

type Uint64

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

func (*Uint64) IsNonZero

func (a *Uint64) IsNonZero() *Uint64

func (*Uint64) IsZero

func (a *Uint64) IsZero() *Uint64

Jump to

Keyboard shortcuts

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