You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

doc.go 876B

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