PageRenderTime 41ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/Godeps/_workspace/src/github.com/stretchr/testify/require/doc.go

https://github.com/vmarmol/cadvisor
Go | 77 lines | 1 code | 0 blank | 76 comment | 0 complexity | d155f6f75dc3e0c522f183b0217b90d9 MD5 | raw file
Possible License(s): Apache-2.0, BSD-3-Clause
  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. //
  28. // Here is an overview of the assert functions:
  29. //
  30. // require.Equal(t, expected, actual [, message [, format-args])
  31. //
  32. // require.NotEqual(t, notExpected, actual [, message [, format-args]])
  33. //
  34. // require.True(t, actualBool [, message [, format-args]])
  35. //
  36. // require.False(t, actualBool [, message [, format-args]])
  37. //
  38. // require.Nil(t, actualObject [, message [, format-args]])
  39. //
  40. // require.NotNil(t, actualObject [, message [, format-args]])
  41. //
  42. // require.Empty(t, actualObject [, message [, format-args]])
  43. //
  44. // require.NotEmpty(t, actualObject [, message [, format-args]])
  45. //
  46. // require.Error(t, errorObject [, message [, format-args]])
  47. //
  48. // require.NoError(t, errorObject [, message [, format-args]])
  49. //
  50. // require.EqualError(t, theError, errString [, message [, format-args]])
  51. //
  52. // require.Implements(t, (*MyInterface)(nil), new(MyObject) [,message [, format-args]])
  53. //
  54. // require.IsType(t, expectedObject, actualObject [, message [, format-args]])
  55. //
  56. // require.Contains(t, string, substring [, message [, format-args]])
  57. //
  58. // require.NotContains(t, string, substring [, message [, format-args]])
  59. //
  60. // require.Panics(t, func(){
  61. //
  62. // // call code that should panic
  63. //
  64. // } [, message [, format-args]])
  65. //
  66. // require.NotPanics(t, func(){
  67. //
  68. // // call code that should not panic
  69. //
  70. // } [, message [, format-args]])
  71. //
  72. // require.WithinDuration(t, timeA, timeB, deltaTime, [, message [, format-args]])
  73. //
  74. // require.InDelta(t, numA, numB, delta, [, message [, format-args]])
  75. //
  76. // require.InEpsilon(t, numA, numB, epsilon, [, message [, format-args]])
  77. package require