expect

package
v0.0.0-...-b425644 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

README

expect

Custom assertions for go tests.

Example

func TestRun(t *testing.T) {
	expect := expect.New(t)

	expect(nil).ToBeNil()
	expect("").ToNotBeNil()

	expect("test").ToHavePrefix("te")
	expect("test").ToHaveSuffix("st")
	expect("test").ToContain("es")
	expect("a").ToNotBeNil()
	expect("a").ToEqual("a")
	expect("a").ToNotEqual("b")

	expect(int64(1)).ToEqual(1)
	expect(1).ToEqual(1)

	expect("test").ToContain("es")

	arr := []string{"a", "b", "c"}
	expect(arr).ToHaveLength(3)
	expect(arr).ToContain("a")
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(t *testing.T) func(target interface{}) *expectation

Types

This section is empty.

Jump to

Keyboard shortcuts

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