eval

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(list, element interface{}) bool

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

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

func EndsWith

func EndsWith(v1 interface{}, v2 interface{}) bool

EndsWith return true if v1 endswith v2

func Equal

func Equal(expected, actual interface{}) bool

Equal return true if expected equals to actual

func Greater

func Greater(e1 interface{}, e2 interface{}) bool

Greater asserts that the first element is greater than the second

assert.Greater(t, 2, 1)
assert.Greater(t, float64(2), float64(1))
assert.Greater(t, "b", "a")

func GreaterOrEqual

func GreaterOrEqual(e1 interface{}, e2 interface{}) bool

GreaterOrEqual asserts that the first element is greater than or equal to the second

assert.GreaterOrEqual(t, 2, 1)
assert.GreaterOrEqual(t, 2, 2)
assert.GreaterOrEqual(t, "b", "a")
assert.GreaterOrEqual(t, "b", "b")

func In

func In(element, list interface{}) bool

In return true if element in list

func Less

func Less(e1 interface{}, e2 interface{}) bool

Less asserts that the first element is less than the second

assert.Less(t, 1, 2)
assert.Less(t, float64(1), float64(2))
assert.Less(t, "a", "b")

func LessOrEqual

func LessOrEqual(e1 interface{}, e2 interface{}) bool

LessOrEqual asserts that the first element is less than or equal to the second

assert.LessOrEqual(t, 1, 2)
assert.LessOrEqual(t, 2, 2)
assert.LessOrEqual(t, "a", "b")
assert.LessOrEqual(t, "b", "b")

func NotContains

func NotContains(list, element interface{}, msgAndArgs ...interface{}) bool

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

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

func NotEndsWith

func NotEndsWith(v1 interface{}, v2 interface{}) bool

NotEndsWith return true if v1 not endswith v2

func NotEqual

func NotEqual(expected, actual interface{}) bool

NotEqual return true if expected not equals to actual

func NotIn

func NotIn(element, list interface{}) bool

NotIn return true if element not in list

func NotStartsWith

func NotStartsWith(v1 interface{}, v2 interface{}) bool

NotStartsWith return true if v1 not startswith v2

func ObjectsAreEqual

func ObjectsAreEqual(expected, actual interface{}) bool

ObjectsAreEqual determines if two objects are considered equal. This function does no assertion of any kind.

func StartsWith

func StartsWith(v1 interface{}, v2 interface{}) bool

StartsWith return true if v1 startswith v2

func StringContains added in v0.0.9

func StringContains(v1 interface{}, v2 interface{}) bool

StringContains return true if v1 contains v2

func ValueEqual added in v0.0.7

func ValueEqual(e1 interface{}, e2 interface{}) bool

ValueEqual asserts that the first element is value-equal to the second only care about the value, will cast the type to the same type before do compare

assert.ValueEqual(t, 2, 1)
assert.ValueEqual(t, 2, float64(2.0))
assert.ValueEqual(t, "b", "a")

it's different to the `Equals` which use reflect.DeepEqual will check the type and value are the same

Types

type CompareType

type CompareType int

Jump to

Keyboard shortcuts

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