assert

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package assert provides value assertions.

Index

Constants

This section is empty.

Variables

View Source
var AppendError = multierror.Append

AppendError is a helper function that will append more errors onto an Error in order to create a larger multi-error.

Functions

func Contains

func Contains(assertion Assertion) func(*query.Query) Assertion

Contains returns an assertion to ensure a value contains the value.

func NotContains

func NotContains(assertion Assertion) func(*query.Query) Assertion

NotContains returns an assertion to ensure a value doesn't contain the value.

Types

type Assertion

type Assertion interface {
	Assert(v interface{}) error
}

Assertion implements value assertion.

func Build

func Build(expect interface{}) Assertion

Build creates an assertion from Go value.

func Equal

func Equal(q *query.Query, expected interface{}) Assertion

Equal returns an assertion to ensure a value equals the expected value.

func NotZero

func NotZero(q *query.Query) Assertion

NotZero returns an assertion to ensure a value is not zero value.

type AssertionFunc

type AssertionFunc func(v interface{}) error

AssertionFunc is an adaptor to allow the use of ordinary functions as assertions.

func (AssertionFunc) Assert

func (f AssertionFunc) Assert(v interface{}) error

Assert asserts the v.

type Error

type Error = multierror.Error

Error is an error type to track multiple errors.

Jump to

Keyboard shortcuts

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