1 // Package assert provides a set of comprehensive testing tools for use with the normal Go testing system.
5 // The following is a complete example using assert in a standard test function:
8 // "github.com/stretchr/testify/assert"
11 // func TestSomething(t *testing.T) {
13 // var a string = "Hello"
14 // var b string = "Hello"
16 // assert.Equal(t, a, b, "The two words should be the same.")
20 // if you assert many times, use the format below:
24 // "github.com/stretchr/testify/assert"
27 // func TestSomething(t *testing.T) {
28 // assert := assert.New(t)
30 // var a string = "Hello"
31 // var b string = "Hello"
33 // assert.Equal(a, b, "The two words should be the same.")
38 // Assertions allow you to easily write test code, and are global funcs in the `assert` package.
39 // All assertion functions take, as the first argument, the `*testing.T` object provided by the
40 // testing framework. This allows the assertion funcs to write the failings and other details to
43 // Every assertion function also takes an optional string message as the final argument,
44 // allowing custom error messages to be appended to the message the assertion method outputs.