comparable

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Equal added in v0.7.0

func Equal[T comparable](in T) pepper.Matcher[T]

Equal is an alias for EqualTo.

Example
t := &SpyTB{}
Expect(t, 2).To(Equal(2))
fmt.Println(t.Result())
Output:

Test passed
Example (Fail)
t := &SpyTB{}
Expect(t, 2).To(Equal(1))
fmt.Println(t.Result())
Output:

Test failed: [expected 2 to be equal to 1, but it was 2]

func EqualTo

func EqualTo[T comparable](expected T) pepper.Matcher[T]

EqualTo checks if a value is equal to another value.

Example
t := &SpyTB{}
Expect(t, 5).To(EqualTo(5))
fmt.Println(t.Result())
Output:

Test passed
Example (Fail)
t := &SpyTB{}
Expect(t, 5).To(EqualTo(4))
fmt.Println(t.Result())
Output:

Test failed: [expected 5 to be equal to 4, but it was 5]

func GreaterThan

func GreaterThan[T cmp.Ordered](in T) pepper.Matcher[T]

GreaterThan checks if a value is greater than another value.

Example
t := &SpyTB{}
Expect(t, 5).To(GreaterThan(4))
fmt.Println(t.Result())
Output:

Test passed
Example (Fail)
t := &SpyTB{}
Expect(t, 5).To(GreaterThan(6))
fmt.Println(t.Result())
Output:

Test failed: [expected 5 to be greater than 6, but it was 5]

func LessThan

func LessThan[T cmp.Ordered](in T) pepper.Matcher[T]

LessThan checks if a value is less than another value.

Example
t := &SpyTB{}
Expect(t, 5).To(LessThan(6))
fmt.Println(t.Result())
Output:

Test passed
Example (Fail)
t := &SpyTB{}
Expect(t, 5).To(LessThan(4))
fmt.Println(t.Result())
Output:

Test failed: [expected 5 to be less than 4, but it was 5]

Types

This section is empty.

Jump to

Keyboard shortcuts

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