Skip to content
This repository has been archived by the owner on May 2, 2020. It is now read-only.
/ is Public archive

Is provides a quick, clean and simple framework for writing Go tests.

License

Notifications You must be signed in to change notification settings

tylerstillwater/is

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

is GoDev Build Status

Archived

is has been archived in favor of Proof


Is provides a quick, clean and simple framework for writing Go tests.

Installation

To install, simply execute:

go get -u github.com/tylerb/is/v3

Usage

func TestSomething(t *testing.T) {
	assert := is.New(t)

	expected := 10
	actual, _ := awesomeFunction()
	assert.Equal(actual, expected)
}

If you'd like a bit more information when a test fails, you may use the Msg() method:

func TestSomething(t *testing.T) {
	assert := is.New(t)

	expected := 10
	actual, details := awesomeFunction()
	assert.Msg("actual details: %s", details).Equal(actual, expected)
}

By default, any assertion that fails will halt termination of the test. If you would like to run a group of assertions in a row, you may use the Lax method. This is useful for asserting/printing many values at once, so you can correct all the issues between test runs.

func TestSomething(t *testing.T) {
	assert := is.New(t)

	assert.Lax(func (lax Asserter) {
		lax.Equal(1, 2)
		lax.True(false)
		lax.ShouldPanic(func(){})
	}) 
}

If any of the assertions fail inside that function, an additional error will be printed and test execution will halt.

About

Is provides a quick, clean and simple framework for writing Go tests.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages