Simple assertions for Go (golang) tests
Go
Switch branches/tags
Nothing to show
Clone or download

README.md

assert

Build Status GoDoc Go Report Card

assert is Go package that provides convenience methods for writing assertions in standard Go tests.

You can write this test with assert:

func TestSomething(t *testing.T) {
  i, err := doSomething()
  assert.NoErr(t, err)
  assert.Equal(t, i, 123, "returned integer")
}

Instead of writing this test with only the standard testing library:

func TestSomething(t *testing.T) {
  i, err := doSomething()
  if err != nil {
    t.Fatalf("error encountered: %s", err)
  }
  if i != 123 {
    t.Fatalf("returned integer was %d, not %d", i, 123)
  }
}