|
| 1 | +// Package assert provides a set of testing tools for use with the standard Go testing system. |
| 2 | +// |
| 3 | +// # Note |
| 4 | +// |
| 5 | +// All functions in this package return a bool value indicating whether the assertion has passed. |
| 6 | +// |
| 7 | +// # Example usage |
| 8 | +// |
| 9 | +// The following is a complete example using assert in a standard test function: |
| 10 | +// |
| 11 | +// import ( |
| 12 | +// "testing" |
| 13 | +// "github.com/go-openapi/testify/v2/assert" |
| 14 | +// ) |
| 15 | +// |
| 16 | +// func TestSomething(t *testing.T) { |
| 17 | +// |
| 18 | +// var a string = "Hello" |
| 19 | +// var b string = "Hello" |
| 20 | +// |
| 21 | +// assert.Equal(t, a, b, "The two words should be the same.") |
| 22 | +// |
| 23 | +// } |
| 24 | +// |
| 25 | +// if you assert many times, use the format below: |
| 26 | +// |
| 27 | +// import ( |
| 28 | +// "testing" |
| 29 | +// "github.com/go-openapi/testify/v2/assert" |
| 30 | +// ) |
| 31 | +// |
| 32 | +// func TestSomething(t *testing.T) { |
| 33 | +// assert := assert.New(t) |
| 34 | +// |
| 35 | +// var a string = "Hello" |
| 36 | +// var b string = "Hello" |
| 37 | +// |
| 38 | +// assert.Equal(a, b, "The two words should be the same.") |
| 39 | +// } |
| 40 | +// |
| 41 | +// # Assertions |
| 42 | +// |
| 43 | +// Assertions allow you to easily write test code. |
| 44 | +// |
| 45 | +// All assertion functions take as the first argument, the [*testing.T] object provided by the |
| 46 | +// standard testing framework. |
| 47 | +// |
| 48 | +// This allows the assertion functions to write the failings and other details to the correct place. |
| 49 | +// |
| 50 | +// Every assertion function also takes an optional string message as the final argument, |
| 51 | +// allowing custom error messages to be appended to the message the assertion method outputs. |
| 52 | +// |
| 53 | +// See [our doc site](https://go-openapi.github.io/testify/) for usage and examples and |
| 54 | +// [go docs](https://pkg.go/dev/go-openapi/testify) for complete reference. |
1 | 55 | package assert |
0 commit comments