PageRenderTime 42ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

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

https://github.com/mmcgrana/pgpin
Go | 74 lines | 1 code | 1 blank | 72 comment | 0 complexity | 9509dff568601123e4fff70ddc96bebe MD5 | raw file
Possible License(s): BSD-3-Clause, Apache-2.0
  1. // A set of comprehensive testing tools for use with the normal Go testing system.
  2. //
  3. // Example Usage
  4. //
  5. // The following is a complete example using assert in a standard test function:
  6. // import (
  7. // "testing"
  8. // "github.com/stretchr/testify/assert"
  9. // )
  10. //
  11. // func TestSomething(t *testing.T) {
  12. //
  13. // var a string = "Hello"
  14. // var b string = "Hello"
  15. //
  16. // assert.Equal(t, a, b, "The two words should be the same.")
  17. //
  18. // }
  19. //
  20. // Assertions
  21. //
  22. // Assertions allow you to easily write test code, and are global funcs in the `assert` package.
  23. // All assertion functions take, as the first argument, the `*testing.T` object provided by the
  24. // testing framework. This allows the assertion funcs to write the failings and other details to
  25. // the correct place.
  26. //
  27. // Every assertion function also takes an optional string message as the final argument,
  28. // allowing custom error messages to be appended to the message the assertion method outputs.
  29. //
  30. // Here is an overview of the assert functions:
  31. //
  32. // assert.Equal(t, expected, actual [, message [, format-args])
  33. //
  34. // assert.NotEqual(t, notExpected, actual [, message [, format-args]])
  35. //
  36. // assert.True(t, actualBool [, message [, format-args]])
  37. //
  38. // assert.False(t, actualBool [, message [, format-args]])
  39. //
  40. // assert.Nil(t, actualObject [, message [, format-args]])
  41. //
  42. // assert.NotNil(t, actualObject [, message [, format-args]])
  43. //
  44. // assert.Empty(t, actualObject [, message [, format-args]])
  45. //
  46. // assert.NotEmpty(t, actualObject [, message [, format-args]])
  47. //
  48. // assert.Error(t, errorObject [, message [, format-args]])
  49. //
  50. // assert.NoError(t, errorObject [, message [, format-args]])
  51. //
  52. // assert.Implements(t, (*MyInterface)(nil), new(MyObject) [,message [, format-args]])
  53. //
  54. // assert.IsType(t, expectedObject, actualObject [, message [, format-args]])
  55. //
  56. // assert.Contains(t, string, substring [, message [, format-args]])
  57. //
  58. // assert.NotContains(t, string, substring [, message [, format-args]])
  59. //
  60. // assert.Panics(t, func(){
  61. //
  62. // // call code that should panic
  63. //
  64. // } [, message [, format-args]])
  65. //
  66. // assert.NotPanics(t, func(){
  67. //
  68. // // call code that should not panic
  69. //
  70. // } [, message [, format-args]])
  71. //
  72. // assert.WithinDuration(t, timeA, timeB, deltaTime, [, message [, format-args]])
  73. package assert