assert

package
v0.0.0-...-31ab3be Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package assert contains a system-specific wrapper for testify assertions

Index

Constants

View Source
const (
	InvalidTestExpression = "invalid test expression: %v"
)

Error messages

Variables

This section is empty.

Functions

This section is empty.

Types

type Any

type Any interface{}

Any is the friendly name for a generic interface

type Wrapper

type Wrapper struct {
	*assert.Assertions
}

Wrapper wraps the testify assertions module in order to perform checking and conversion that is system-specific

func New

func New(t *testing.T) *Wrapper

New instantiates a new Wrapper instance from the specified test

func (*Wrapper) Compare

func (w *Wrapper) Compare(c data.Comparison, l data.Number, r data.Number)

Compare tests if the Comparison of two Numbers is correct

func (*Wrapper) Contains

func (w *Wrapper) Contains(expect string, expr data.Value)

Contains check if the expected string is in the provided Value

func (*Wrapper) Equal

func (w *Wrapper) Equal(expect Any, expr Any)

Equal tests a Value for some kind of equality. Performs checks to do so

func (*Wrapper) Eval

func (w *Wrapper) Eval(src string) data.Value

Eval will evaluate source code on behalf of the test framework

func (*Wrapper) EvalTo

func (w *Wrapper) EvalTo(src string, expect data.Value)

EvalTo will evaluate source code and test for an expected result

func (*Wrapper) ExpectNoPanic

func (w *Wrapper) ExpectNoPanic()

ExpectNoPanic is sued with a defer to make sure no error was triggered

func (*Wrapper) ExpectPanic

func (w *Wrapper) ExpectPanic(errStr string)

ExpectPanic is used with a defer to make sure an error was triggered

func (*Wrapper) False

func (w *Wrapper) False(expr Any)

False tests a Value for boolean false

func (*Wrapper) Falsey

func (w *Wrapper) Falsey(expr data.Value)

Falsey tests a Value for system-specific Falsey

func (*Wrapper) Identical

func (w *Wrapper) Identical(expect Any, expr Any)

Identical tests that two values are referentially identical

func (*Wrapper) NotContains

func (w *Wrapper) NotContains(expect string, expr data.Value)

NotContains checks if the expected string is not in the provided Value

func (*Wrapper) NotIdentical

func (w *Wrapper) NotIdentical(expect Any, expr Any)

NotIdentical tests that two values are not referentially identical

func (*Wrapper) Number

func (w *Wrapper) Number(expect float64, expr Any)

Number tests a Value for numeric equality

func (*Wrapper) PanicWith

func (w *Wrapper) PanicWith(src string, err error)

PanicWith will evaluate source code and expect a panic to happen

func (*Wrapper) String

func (w *Wrapper) String(expect string, expr Any)

String tests a Value for string equality

func (*Wrapper) True

func (w *Wrapper) True(expr Any)

True tests a Value for boolean true

func (*Wrapper) Truthy

func (w *Wrapper) Truthy(expr data.Value)

Truthy tests a Value for system-specific Truthy

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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