Skip to content
/ is Public

Professional lightweight testing mini-framework for Go.

License

Notifications You must be signed in to change notification settings

matryer/is

Folders and files

NameName
Last commit message
Last commit date
May 3, 2023
Feb 22, 2020
Feb 15, 2018
Dec 6, 2016
Apr 22, 2020
Jun 12, 2018
May 3, 2023
Jun 30, 2020
May 3, 2023
May 3, 2023
May 3, 2023
Oct 24, 2022
May 3, 2023
Oct 30, 2020

Repository files navigation

is GoDoc Go Report Card

Professional lightweight testing mini-framework for Go.

  • Easy to write and read
  • Beautifully simple API with everything you need: is.Equal, is.True, is.NoErr, and is.Fail
  • Use comments to add descriptions (which show up when tests fail)

Failures are very easy to read:

Examples of failures

Usage

The following code shows a range of useful ways you can use the helper methods:

func Test(t *testing.T) {
	is := is.New(t)
	signedin, err := isSignedIn(ctx)
	is.NoErr(err)            // isSignedIn error
	is.Equal(signedin, true) // must be signed in
	body := readBody(r)
	is.True(strings.Contains(body, "Hi there"))
}

Color

To turn off the colors, run go test with the -nocolor flag, or with the env var NO_COLOR (with any value).

go test -nocolor
NO_COLOR=1 go test