Skip to content

gogunit/gunit

Repository files navigation

gunit

Go CodeQL GitHub go.mod Go version Go Report Card GoDoc reference example

gounit is test assertions library for Go. It was developed to address the shortcoming of many assertion frameworks that employ assertion of types at runtime rather than compile time.

Examples

// direct assertion style
func Test_nine_plus_two_is_greater_than_ten(t *testing.T) {
	actual := 9 + 2
	expected := 10
	gunit.Number(t, actual).GreaterThan(expected)
}

// wrap testing.T struct
func Test_nine_plus_two_is_greater_than_ten(t *testing.T) {
	assert := gunit.New(t)
	actual := 9 + 2
	expected := 10
	assert.Int(actual).GreaterThan(expected)
}

About

Go Unit testing assertions

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •  

Languages