doc.go 826 B

12345678910111213141516171819202122232425262728
  1. // Alternative testing tools which stop test execution if test failed.
  2. //
  3. // Example Usage
  4. //
  5. // The following is a complete example using require in a standard test function:
  6. // import (
  7. // "testing"
  8. // "github.com/stretchr/testify/require"
  9. // )
  10. //
  11. // func TestSomething(t *testing.T) {
  12. //
  13. // var a string = "Hello"
  14. // var b string = "Hello"
  15. //
  16. // require.Equal(t, a, b, "The two words should be the same.")
  17. //
  18. // }
  19. //
  20. // Assertions
  21. //
  22. // The `require` package have same global functions as in the `assert` package,
  23. // but instead of returning a boolean result they call `t.FailNow()`.
  24. //
  25. // Every assertion function also takes an optional string message as the final argument,
  26. // allowing custom error messages to be appended to the message the assertion method outputs.
  27. package require