enhanced readme

pull/14/merge
Mat Ryer 2012-10-16 21:25:58 +01:00
parent ca63639b8d
commit 3e33cbfbd4
1 changed files with 12 additions and 3 deletions

View File

@ -14,12 +14,21 @@ Assert package
The `assert` package provides some helpful methods that allow you to write better test code in Go.
Some examples:
See it in action:
func TestSomething(t *testing.T) {
assert.Equal(t, 123, 123, "they should be equal")
assert.NotNil(t, object)
assert.Nil(t, object)
}
if assert.NotNil(t, object) {
assert.Equal(t, "Something", object.Value)
}
}
* Every assert func takes the `testing.T` object as the first argument. This is how it writes the errors out through the normal `go test` capabilities.
* Every assert func returns a bool indicating whether the assertion was successful or not, this is useful for if you want to go on making further assertions under certain conditions.