zuern / is

Fork of https://github.com/matryer/is

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

is GoDoc Go Report Card

Professional lightweight testing mini-framework for Go.

This is a fork of https://github.com/matryer/is, which adds support for supplying a message failed tests as an arg or as a comment.

Features

  • Easy to write and read
  • Beautifully simple API with everything you need: is.Equal, is.True, is.NoErr, and is.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")) // Should be in body
}

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

About

Fork of https://github.com/matryer/is

License:MIT License


Languages

Language:Go 100.0%