assert

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2020 License: LGPL-2.1 Imports: 7 Imported by: 0

Documentation

Overview

Suite of testing-oriented commands that will trigger errors or failures if they aren't satistifed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AssertArgs added in v0.8.2

type AssertArgs struct {
	Message string `json:"message"`
	// contains filtered or unexported fields
}

func (*AssertArgs) Error added in v0.8.2

func (self *AssertArgs) Error() string

type BinaryComparison

type BinaryComparison struct {
	AssertArgs
	Value interface{} `json:"value"`
	Test  string      `json:"test"`
}

type Commands

type Commands struct {
	utils.Module
	// contains filtered or unexported fields
}

func New

func New(env utils.Runtime) *Commands

func (*Commands) Compare

func (self *Commands) Compare(have interface{}, args *BinaryComparison) error

Return an error if the given value is not equal to the other value.

func (*Commands) Contains

func (self *Commands) Contains(have interface{}, args *BinaryComparison) error

Return an error if the given value does not contain another value.

func (*Commands) Empty

func (self *Commands) Empty(value interface{}, args *AssertArgs) error

Return an error if the given value not empty.

func (*Commands) Equal

func (self *Commands) Equal(have interface{}, args *BinaryComparison) error

Return an error if the given value is not equal to the other value.

func (*Commands) Exists

func (self *Commands) Exists(value interface{}, args *AssertArgs) error

Return an error if the given value is null or zero-length.

func (*Commands) False

func (self *Commands) False(value interface{}, args *AssertArgs) error

Return an error if the given value is not false.

func (*Commands) Gt

func (self *Commands) Gt(have interface{}, args *BinaryComparison) error

Return an error if the given value is not numerically greater than the second value.

func (*Commands) Gte

func (self *Commands) Gte(have interface{}, args *BinaryComparison) error

Return an error if the given value is not numerically greater than or equal to the second value.

func (*Commands) IsArray

func (self *Commands) IsArray(value interface{}, args *AssertArgs) error

Return an error if the given value is not an array.

func (*Commands) IsBoolean

func (self *Commands) IsBoolean(value interface{}, args *AssertArgs) error

Return an error if the given value is not a boolean value.

func (*Commands) IsDuration

func (self *Commands) IsDuration(value interface{}, args *AssertArgs) error

Return an error if the given value is not parsable as a duration.

func (*Commands) IsNumeric

func (self *Commands) IsNumeric(value interface{}, args *AssertArgs) error

Return an error if the given value is not a numeric value.

func (*Commands) IsObject

func (self *Commands) IsObject(value interface{}, args *AssertArgs) error

Return an error if the given value is not an object.

func (*Commands) IsScalar

func (self *Commands) IsScalar(value interface{}, args *AssertArgs) error

Return an error if the given value is not a scalar value.

func (*Commands) IsString

func (self *Commands) IsString(value interface{}, args *AssertArgs) error

Return an error if the given value is not a string.

func (*Commands) IsTime

func (self *Commands) IsTime(value interface{}, args *AssertArgs) error

Return an error if the given value is not parsable as a time.

func (*Commands) Lt

func (self *Commands) Lt(have interface{}, args *BinaryComparison) error

Return an error if the given value is not numerically less than the second value.

func (*Commands) Lte

func (self *Commands) Lte(have interface{}, args *BinaryComparison) error

Return an error if the given value is not numerically less than or equal to the second value.

func (*Commands) NotContains

func (self *Commands) NotContains(have interface{}, args *BinaryComparison) error

Return an error if the given value contains another value.

func (*Commands) NotEqual

func (self *Commands) NotEqual(have interface{}, args *BinaryComparison) error

Return an error if the given value is equal to the other value.

func (*Commands) NotNull

func (self *Commands) NotNull(value interface{}, args *AssertArgs) error

Return an error if the given value is null.

func (*Commands) Null

func (self *Commands) Null(value interface{}, args *AssertArgs) error

Return an error if the given value is not null.

func (*Commands) True

func (self *Commands) True(value interface{}, args *AssertArgs) error

Return an error if the given value is not true.

Jump to

Keyboard shortcuts

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