helpers

package
v1.3.1-0...-9810bd5 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 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, contains interface{}) bool

Contains asserts that the specified string, list(array, slice...) or map contains the specified substring or element.

helpers.Contains("Hello World", "World")
helpers.Contains(["Hello", "World"], "World")
helpers.Contains({"Hello": "World"}, "Hello")

func Empty

func Empty(object interface{}) bool

Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either a slice or a channel with len == 0.

helpers.Empty(obj)

func Equal

func Equal(expected, actual interface{}) bool

Equal asserts that two objects are equal.

helpers.Equal(123, 123)

Pointer variable equality is determined based on the equality of the referenced values (as opposed to the memory addresses). Function equality cannot be determined and will always fail.

func GetValueFromYAML

func GetValueFromYAML[T any](data map[string]interface{}, key string) (T, error)

func NotContains

func NotContains(s, contains interface{}) bool

NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the specified substring or element.

helpers.NotContains("Hello World", "Earth")
helpers.NotContains(["Hello", "World"], "Earth")
helpers.NotContains({"Hello": "World"}, "Earth")

func NotEmpty

func NotEmpty(object interface{}) bool

NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either a slice or a channel with len == 0.

if helpers.NotEmpty(obj) {
  helpers.Equal("two", obj[1])
}

func NotEqual

func NotEqual(expected, actual interface{}) bool

NotEqual asserts that the specified values are NOT equal.

helpers.NotEqual(obj1, obj2)

Pointer variable equality is determined based on the equality of the referenced values (as opposed to the memory addresses).

func ObjectsAreEqual

func ObjectsAreEqual(expected, actual interface{}) bool

ObjectsAreEqual determines if two objects are considered equal.

This function does no assertion of any kind.

Types

This section is empty.

Jump to

Keyboard shortcuts

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