assert

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(s, substr string, message ...string) error

Contains asserts that a string contains a substring

func Empty

func Empty(value interface{}, message ...string) error

Empty asserts that a string, slice, or map is empty

func Equal

func Equal(expected, actual interface{}, message ...string) error

Equal asserts that two values are equal

func False

func False(value bool, message ...string) error

False asserts that a value is false

func Nil

func Nil(value interface{}, message ...string) error

Nil asserts that a value is nil

func NotContains

func NotContains(s, substr string, message ...string) error

NotContains asserts that a string does not contain a substring

func NotEqual

func NotEqual(expected, actual interface{}, message ...string) error

NotEqual asserts that two values are not equal

func NotNil

func NotNil(value interface{}, message ...string) error

NotNil asserts that a value is not nil

func True

func True(value bool, message ...string) error

True asserts that a value is true

func YAMLContains

func YAMLContains(path, field, substr string, message ...string) error

YAMLContains asserts that a YAML file's field contains a substring.

func YAMLField

func YAMLField(path, field, expectedValue string, message ...string) error

YAMLField asserts that a YAML file contains a field with the expected value. It parses the YAML file and checks if the specified field equals the expected value.

func YAMLFieldExists

func YAMLFieldExists(path, field string, message ...string) error

YAMLFieldExists asserts that a YAML file contains a field (regardless of value).

Types

type Error

type Error struct {
	Message  string
	Expected interface{}
	Actual   interface{}
}

Error represents an assertion error

func (*Error) Error

func (e *Error) Error() string

Jump to

Keyboard shortcuts

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