stretchr/testify — pull request #69 by ascheglov (2014-07-16 13:59:10+00:00)
Title: Add fatal assertions

This pull-request adds "fatal" assertions which call `t.FailNow()` instead of `t.Fail()`.

The use-case is quite common - it's quite annoying to write tests like

func TestFoo(t *testing.T) {
a, err := NewA()
if !assert.NoError(t, err) {
return
}
res, err := Foo(a)
if assert.NotEmpty(t, res) {
assert.Equals(t, res[0], 1)
...

So it would be nice to have an alternative set of assertions which would fail and abort current test:

func TestFoo(t *testing.T) {
a, err := NewA()
require.NoError(t, err)
res, err := Foo(a)
require.NotEmpty(t, res)
assert.Equals(t, res[0], 1)

This PR adds new package `require` (we can discuss its name) which adds wrappers for all functions in the `assert` package.
It doesn't have the `Assertions` type because most probably both `require` and `assert` will be used together, and having two variables (one for `assert.Assertions`, another - `require.Assertions`) wouldn't look good.