messages.go 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. package assertions
  2. const ( // equality
  3. shouldHaveBeenEqual = "Expected: '%v'\nActual: '%v'\n(Should be equal)"
  4. shouldNotHaveBeenEqual = "Expected '%v'\nto NOT equal '%v'\n(but it did)!"
  5. shouldHaveBeenAlmostEqual = "Expected '%v' to almost equal '%v' (but it didn't)!"
  6. shouldHaveNotBeenAlmostEqual = "Expected '%v' to NOT almost equal '%v' (but it did)!"
  7. shouldHaveResembled = "Expected: '%#v'\nActual: '%#v'\n(Should resemble)!"
  8. shouldHaveResembledTypeMismatch = "Expected: '%#v'\nActual: '%#v'\n(Type mismatch: '%T' vs '%T')!"
  9. shouldNotHaveResembled = "Expected '%#v'\nto NOT resemble '%#v'\n(but it did)!"
  10. shouldBePointers = "Both arguments should be pointers "
  11. shouldHaveBeenNonNilPointer = shouldBePointers + "(the %s was %s)!"
  12. shouldHavePointedTo = "Expected '%+v' (address: '%v') and '%+v' (address: '%v') to be the same address (but their weren't)!"
  13. shouldNotHavePointedTo = "Expected '%+v' and '%+v' to be different references (but they matched: '%v')!"
  14. shouldHaveBeenNil = "Expected: nil\nActual: '%v'"
  15. shouldNotHaveBeenNil = "Expected '%+v' to NOT be nil (but it was)!"
  16. shouldHaveBeenTrue = "Expected: true\nActual: %v"
  17. shouldHaveBeenFalse = "Expected: false\nActual: %v"
  18. shouldHaveBeenZeroValue = "'%+v' should have been the zero value" //"Expected: (zero value)\nActual: %v"
  19. )
  20. const ( // quantity comparisons
  21. shouldHaveBeenGreater = "Expected '%v' to be greater than '%v' (but it wasn't)!"
  22. shouldHaveBeenGreaterOrEqual = "Expected '%v' to be greater than or equal to '%v' (but it wasn't)!"
  23. shouldHaveBeenLess = "Expected '%v' to be less than '%v' (but it wasn't)!"
  24. shouldHaveBeenLessOrEqual = "Expected '%v' to be less than or equal to '%v' (but it wasn't)!"
  25. shouldHaveBeenBetween = "Expected '%v' to be between '%v' and '%v' (but it wasn't)!"
  26. shouldNotHaveBeenBetween = "Expected '%v' NOT to be between '%v' and '%v' (but it was)!"
  27. shouldHaveDifferentUpperAndLower = "The lower and upper bounds must be different values (they were both '%v')."
  28. shouldHaveBeenBetweenOrEqual = "Expected '%v' to be between '%v' and '%v' or equal to one of them (but it wasn't)!"
  29. shouldNotHaveBeenBetweenOrEqual = "Expected '%v' NOT to be between '%v' and '%v' or equal to one of them (but it was)!"
  30. )
  31. const ( // collections
  32. shouldHaveContained = "Expected the container (%v) to contain: '%v' (but it didn't)!"
  33. shouldNotHaveContained = "Expected the container (%v) NOT to contain: '%v' (but it did)!"
  34. shouldHaveBeenIn = "Expected '%v' to be in the container (%v, but it wasn't)!"
  35. shouldNotHaveBeenIn = "Expected '%v' NOT to be in the container (%v, but it was)!"
  36. shouldHaveBeenAValidCollection = "You must provide a valid container (was %v)!"
  37. shouldHaveProvidedCollectionMembers = "This assertion requires at least 1 comparison value (you provided 0)."
  38. shouldHaveBeenEmpty = "Expected %+v to be empty (but it wasn't)!"
  39. shouldNotHaveBeenEmpty = "Expected %+v to NOT be empty (but it was)!"
  40. )
  41. const ( // strings
  42. shouldHaveStartedWith = "Expected '%v'\nto start with '%v'\n(but it didn't)!"
  43. shouldNotHaveStartedWith = "Expected '%v'\nNOT to start with '%v'\n(but it did)!"
  44. shouldHaveEndedWith = "Expected '%v'\nto end with '%v'\n(but it didn't)!"
  45. shouldNotHaveEndedWith = "Expected '%v'\nNOT to end with '%v'\n(but it did)!"
  46. shouldBothBeStrings = "Both arguments to this assertion must be strings (you provided %v and %v)."
  47. shouldBeString = "The argument to this assertion must be a string (you provided %v)."
  48. shouldHaveContainedSubstring = "Expected '%s' to contain substring '%s' (but it didn't)!"
  49. shouldNotHaveContainedSubstring = "Expected '%s' NOT to contain substring '%s' (but it didn't)!"
  50. shouldHaveBeenBlank = "Expected '%s' to be blank (but it wasn't)!"
  51. shouldNotHaveBeenBlank = "Expected value to NOT be blank (but it was)!"
  52. )
  53. const ( // panics
  54. shouldUseVoidNiladicFunction = "You must provide a void, niladic function as the first argument!"
  55. shouldHavePanickedWith = "Expected func() to panic with '%v' (but it panicked with '%v')!"
  56. shouldHavePanicked = "Expected func() to panic (but it didn't)!"
  57. shouldNotHavePanicked = "Expected func() NOT to panic (error: '%+v')!"
  58. shouldNotHavePanickedWith = "Expected func() NOT to panic with '%v' (but it did)!"
  59. )
  60. const ( // type checking
  61. shouldHaveBeenA = "Expected '%v' to be: '%v' (but was: '%v')!"
  62. shouldNotHaveBeenA = "Expected '%v' to NOT be: '%v' (but it was)!"
  63. shouldHaveImplemented = "Expected: '%v interface support'\nActual: '%v' does not implement the interface!"
  64. shouldNotHaveImplemented = "Expected '%v'\nto NOT implement '%v'\n(but it did)!"
  65. shouldCompareWithInterfacePointer = "The expected value must be a pointer to an interface type (eg. *fmt.Stringer)"
  66. shouldNotBeNilActual = "The actual value was 'nil' and should be a value or a pointer to a value!"
  67. )
  68. const ( // time comparisons
  69. shouldUseTimes = "You must provide time instances as arguments to this assertion."
  70. shouldUseTimeSlice = "You must provide a slice of time instances as the first argument to this assertion."
  71. shouldUseDurationAndTime = "You must provide a duration and a time as arguments to this assertion."
  72. shouldHaveHappenedBefore = "Expected '%v' to happen before '%v' (it happened '%v' after)!"
  73. shouldHaveHappenedAfter = "Expected '%v' to happen after '%v' (it happened '%v' before)!"
  74. shouldHaveHappenedBetween = "Expected '%v' to happen between '%v' and '%v' (it happened '%v' outside threshold)!"
  75. shouldNotHaveHappenedOnOrBetween = "Expected '%v' to NOT happen on or between '%v' and '%v' (but it did)!"
  76. // format params: incorrect-index, previous-index, previous-time, incorrect-index, incorrect-time
  77. shouldHaveBeenChronological = "The 'Time' at index [%d] should have happened after the previous one (but it didn't!):\n [%d]: %s\n [%d]: %s (see, it happened before!)"
  78. )