PageRenderTime 43ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

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

https://github.com/vmarmol/cadvisor
Go | 150 lines | 1 code | 0 blank | 149 comment | 0 complexity | 1f5f8f9edb37684ee91fbae4d4dc73cf MD5 | raw file
Possible License(s): Apache-2.0, BSD-3-Clause
  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. // if you assert many times, use the below:
  21. //
  22. // import (
  23. // "testing"
  24. // "github.com/stretchr/testify/assert"
  25. // )
  26. //
  27. // func TestSomething(t *testing.T) {
  28. // assert := assert.New(t)
  29. //
  30. // var a string = "Hello"
  31. // var b string = "Hello"
  32. //
  33. // assert.Equal(a, b, "The two words should be the same.")
  34. // }
  35. //
  36. // Assertions
  37. //
  38. // Assertions allow you to easily write test code, and are global funcs in the `assert` package.
  39. // All assertion functions take, as the first argument, the `*testing.T` object provided by the
  40. // testing framework. This allows the assertion funcs to write the failings and other details to
  41. // the correct place.
  42. //
  43. // Every assertion function also takes an optional string message as the final argument,
  44. // allowing custom error messages to be appended to the message the assertion method outputs.
  45. //
  46. // Here is an overview of the assert functions:
  47. //
  48. // assert.Equal(t, expected, actual [, message [, format-args])
  49. //
  50. // assert.NotEqual(t, notExpected, actual [, message [, format-args]])
  51. //
  52. // assert.True(t, actualBool [, message [, format-args]])
  53. //
  54. // assert.False(t, actualBool [, message [, format-args]])
  55. //
  56. // assert.Nil(t, actualObject [, message [, format-args]])
  57. //
  58. // assert.NotNil(t, actualObject [, message [, format-args]])
  59. //
  60. // assert.Empty(t, actualObject [, message [, format-args]])
  61. //
  62. // assert.NotEmpty(t, actualObject [, message [, format-args]])
  63. //
  64. // assert.Len(t, actualObject, expectedLength, [, message [, format-args]])
  65. //
  66. // assert.Error(t, errorObject [, message [, format-args]])
  67. //
  68. // assert.NoError(t, errorObject [, message [, format-args]])
  69. //
  70. // assert.EqualError(t, theError, errString [, message [, format-args]])
  71. //
  72. // assert.Implements(t, (*MyInterface)(nil), new(MyObject) [,message [, format-args]])
  73. //
  74. // assert.IsType(t, expectedObject, actualObject [, message [, format-args]])
  75. //
  76. // assert.Contains(t, stringOrSlice, substringOrElement [, message [, format-args]])
  77. //
  78. // assert.NotContains(t, stringOrSlice, substringOrElement [, message [, format-args]])
  79. //
  80. // assert.Panics(t, func(){
  81. //
  82. // // call code that should panic
  83. //
  84. // } [, message [, format-args]])
  85. //
  86. // assert.NotPanics(t, func(){
  87. //
  88. // // call code that should not panic
  89. //
  90. // } [, message [, format-args]])
  91. //
  92. // assert.WithinDuration(t, timeA, timeB, deltaTime, [, message [, format-args]])
  93. //
  94. // assert.InDelta(t, numA, numB, delta, [, message [, format-args]])
  95. //
  96. // assert.InEpsilon(t, numA, numB, epsilon, [, message [, format-args]])
  97. //
  98. // assert package contains Assertions object. it has assertion methods.
  99. //
  100. // Here is an overview of the assert functions:
  101. // assert.Equal(expected, actual [, message [, format-args])
  102. //
  103. // assert.NotEqual(notExpected, actual [, message [, format-args]])
  104. //
  105. // assert.True(actualBool [, message [, format-args]])
  106. //
  107. // assert.False(actualBool [, message [, format-args]])
  108. //
  109. // assert.Nil(actualObject [, message [, format-args]])
  110. //
  111. // assert.NotNil(actualObject [, message [, format-args]])
  112. //
  113. // assert.Empty(actualObject [, message [, format-args]])
  114. //
  115. // assert.NotEmpty(actualObject [, message [, format-args]])
  116. //
  117. // assert.Len(actualObject, expectedLength, [, message [, format-args]])
  118. //
  119. // assert.Error(errorObject [, message [, format-args]])
  120. //
  121. // assert.NoError(errorObject [, message [, format-args]])
  122. //
  123. // assert.EqualError(theError, errString [, message [, format-args]])
  124. //
  125. // assert.Implements((*MyInterface)(nil), new(MyObject) [,message [, format-args]])
  126. //
  127. // assert.IsType(expectedObject, actualObject [, message [, format-args]])
  128. //
  129. // assert.Contains(stringOrSlice, substringOrElement [, message [, format-args]])
  130. //
  131. // assert.NotContains(stringOrSlice, substringOrElement [, message [, format-args]])
  132. //
  133. // assert.Panics(func(){
  134. //
  135. // // call code that should panic
  136. //
  137. // } [, message [, format-args]])
  138. //
  139. // assert.NotPanics(func(){
  140. //
  141. // // call code that should not panic
  142. //
  143. // } [, message [, format-args]])
  144. //
  145. // assert.WithinDuration(timeA, timeB, deltaTime, [, message [, format-args]])
  146. //
  147. // assert.InDelta(numA, numB, delta, [, message [, format-args]])
  148. //
  149. // assert.InEpsilon(numA, numB, epsilon, [, message [, format-args]])
  150. package assert