Documentation ¶
Overview ¶
Package assertions contains the implementations for all assertions which are referenced in the convey package for use with the So(...) method.
Index ¶
- func Diffb(a string, b string) []byte
- func NewSimpleTempDir(prefix string) string
- func ShouldAlmostEqual(actual interface{}, expected ...interface{}) string
- func ShouldBeBetween(actual interface{}, expected ...interface{}) string
- func ShouldBeBetweenOrEqual(actual interface{}, expected ...interface{}) string
- func ShouldBeBlank(actual interface{}, expected ...interface{}) string
- func ShouldBeChronological(actual interface{}, expected ...interface{}) string
- func ShouldBeEmpty(actual interface{}, expected ...interface{}) string
- func ShouldBeEqualIgnoringSpaces(actual interface{}, expected ...interface{}) string
- func ShouldBeFalse(actual interface{}, expected ...interface{}) string
- func ShouldBeGreaterThan(actual interface{}, expected ...interface{}) string
- func ShouldBeGreaterThanOrEqualTo(actual interface{}, expected ...interface{}) string
- func ShouldBeIn(actual interface{}, expected ...interface{}) string
- func ShouldBeLessThan(actual interface{}, expected ...interface{}) string
- func ShouldBeLessThanOrEqualTo(actual interface{}, expected ...interface{}) string
- func ShouldBeNil(actual interface{}, expected ...interface{}) string
- func ShouldBeTrue(actual interface{}, expected ...interface{}) string
- func ShouldBeZeroValue(actual interface{}, expected ...interface{}) string
- func ShouldContain(actual interface{}, expected ...interface{}) string
- func ShouldContainModuloWhiteSpace(haystack interface{}, expectedNeedle ...interface{}) string
- func ShouldContainSubstring(actual interface{}, expected ...interface{}) string
- func ShouldEndWith(actual interface{}, expected ...interface{}) string
- func ShouldEqual(actual interface{}, expected ...interface{}) string
- func ShouldHappenAfter(actual interface{}, expected ...interface{}) string
- func ShouldHappenBefore(actual interface{}, expected ...interface{}) string
- func ShouldHappenBetween(actual interface{}, expected ...interface{}) string
- func ShouldHappenOnOrAfter(actual interface{}, expected ...interface{}) string
- func ShouldHappenOnOrBefore(actual interface{}, expected ...interface{}) string
- func ShouldHappenOnOrBetween(actual interface{}, expected ...interface{}) string
- func ShouldHappenWithin(actual interface{}, expected ...interface{}) string
- func ShouldHaveSameTypeAs(actual interface{}, expected ...interface{}) string
- func ShouldImplement(actual interface{}, expectedList ...interface{}) string
- func ShouldMatchModulo(ignoring map[rune]bool, actual interface{}, expected ...interface{}) string
- func ShouldMatchModuloSpaces(actual interface{}, expected ...interface{}) string
- func ShouldMatchModuloWhiteSpace(actual interface{}, expected ...interface{}) string
- func ShouldMatchModuloWhiteSpaceAndComments(commentStart string, actual interface{}, expected ...interface{}) string
- func ShouldMatchModuloWhiteSpaceAndGolangComments(actual interface{}, expected ...interface{}) string
- func ShouldMatchModuloWhiteSpaceAndLuaComments(actual interface{}, expected ...interface{}) string
- func ShouldMatchRegex(actual interface{}, expected ...interface{}) string
- func ShouldNotAlmostEqual(actual interface{}, expected ...interface{}) string
- func ShouldNotBeBetween(actual interface{}, expected ...interface{}) string
- func ShouldNotBeBetweenOrEqual(actual interface{}, expected ...interface{}) string
- func ShouldNotBeBlank(actual interface{}, expected ...interface{}) string
- func ShouldNotBeEmpty(actual interface{}, expected ...interface{}) string
- func ShouldNotBeIn(actual interface{}, expected ...interface{}) string
- func ShouldNotBeNil(actual interface{}, expected ...interface{}) string
- func ShouldNotContain(actual interface{}, expected ...interface{}) string
- func ShouldNotContainSubstring(actual interface{}, expected ...interface{}) string
- func ShouldNotEndWith(actual interface{}, expected ...interface{}) string
- func ShouldNotEqual(actual interface{}, expected ...interface{}) string
- func ShouldNotHappenOnOrBetween(actual interface{}, expected ...interface{}) string
- func ShouldNotHappenWithin(actual interface{}, expected ...interface{}) string
- func ShouldNotHaveSameTypeAs(actual interface{}, expected ...interface{}) string
- func ShouldNotImplement(actual interface{}, expectedList ...interface{}) string
- func ShouldNotPanic(actual interface{}, expected ...interface{}) (message string)
- func ShouldNotPanicWith(actual interface{}, expected ...interface{}) (message string)
- func ShouldNotPointTo(actual interface{}, expected ...interface{}) string
- func ShouldNotResemble(actual interface{}, expected ...interface{}) string
- func ShouldNotStartWith(actual interface{}, expected ...interface{}) string
- func ShouldPanic(actual interface{}, expected ...interface{}) (message string)
- func ShouldPanicWith(actual interface{}, expected ...interface{}) (message string)
- func ShouldPointTo(actual interface{}, expected ...interface{}) string
- func ShouldResemble(actual interface{}, expected ...interface{}) string
- func ShouldStartWith(actual interface{}, expected ...interface{}) string
- func ShouldStartWithModuloWhiteSpace(actual interface{}, expectedPrefix ...interface{}) string
- func ShouldStartWithModuloWhiteSpaceAndComments(commentStart string, actual interface{}, expected ...interface{}) string
- func ShouldStartWithModuloWhiteSpaceAndGolangComments(actual interface{}, expected ...interface{}) string
- func ShouldStartWithModuloWhiteSpaceAndLuaComments(actual interface{}, expected ...interface{}) string
- func SimpleTempFile(dirpath string) *os.File
- type Serializer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSimpleTempDir ¶
func ShouldAlmostEqual ¶
func ShouldAlmostEqual(actual interface{}, expected ...interface{}) string
ShouldAlmostEqual makes sure that two parameters are close enough to being equal. The acceptable delta may be specified with a third argument, or a very small default delta will be used.
func ShouldBeBetween ¶
func ShouldBeBetween(actual interface{}, expected ...interface{}) string
ShouldBeBetween receives exactly three parameters: an actual value, a lower bound, and an upper bound. It ensures that the actual value is between both bounds (but not equal to either of them).
func ShouldBeBetweenOrEqual ¶
func ShouldBeBetweenOrEqual(actual interface{}, expected ...interface{}) string
ShouldBeBetweenOrEqual receives exactly three parameters: an actual value, a lower bound, and an upper bound. It ensures that the actual value is between both bounds or equal to one of them.
func ShouldBeBlank ¶
func ShouldBeBlank(actual interface{}, expected ...interface{}) string
ShouldBeBlank receives exactly 1 string parameter and ensures that it is equal to "".
func ShouldBeChronological ¶
func ShouldBeChronological(actual interface{}, expected ...interface{}) string
ShouldBeChronological receives a []time.Time slice and asserts that the are in chronological order starting with the first time.Time as the earliest.
func ShouldBeEmpty ¶
func ShouldBeEmpty(actual interface{}, expected ...interface{}) string
ShouldBeEmpty receives a single parameter (actual) and determines whether or not calling len(actual) would return `0`. It obeys the rules specified by the len function for determining length: http://golang.org/pkg/builtin/#len
func ShouldBeEqualIgnoringSpaces ¶
func ShouldBeEqualIgnoringSpaces(actual interface{}, expected ...interface{}) string
ShouldBeEqualIgnoringSpaces receives exactly two string parameters and ensures that the order of non-space characters in the two strings is identical. Only one character ' ' is considered a space. This is not a general white-space ignoring routine! Differences in tabs or newlines *will* be noticed, and will cause the two strings to look different.
func ShouldBeFalse ¶
func ShouldBeFalse(actual interface{}, expected ...interface{}) string
ShouldBeFalse receives a single parameter and ensures that it is false.
func ShouldBeGreaterThan ¶
func ShouldBeGreaterThan(actual interface{}, expected ...interface{}) string
ShouldBeGreaterThan receives exactly two parameters and ensures that the first is greater than the second.
func ShouldBeGreaterThanOrEqualTo ¶
func ShouldBeGreaterThanOrEqualTo(actual interface{}, expected ...interface{}) string
ShouldBeGreaterThanOrEqualTo receives exactly two parameters and ensures that the first is greater than or equal to the second.
func ShouldBeIn ¶
func ShouldBeIn(actual interface{}, expected ...interface{}) string
ShouldBeIn receives at least 2 parameters. The first is a proposed member of the collection that is passed in either as the second parameter, or of the collection that is comprised of all the remaining parameters. This assertion ensures that the proposed member is in the collection (using ShouldEqual).
func ShouldBeLessThan ¶
func ShouldBeLessThan(actual interface{}, expected ...interface{}) string
ShouldBeLessThan receives exactly two parameters and ensures that the first is less than the second.
func ShouldBeLessThanOrEqualTo ¶
func ShouldBeLessThanOrEqualTo(actual interface{}, expected ...interface{}) string
ShouldBeLessThan receives exactly two parameters and ensures that the first is less than or equal to the second.
func ShouldBeNil ¶
func ShouldBeNil(actual interface{}, expected ...interface{}) string
ShouldBeNil receives a single parameter and ensures that it is nil.
func ShouldBeTrue ¶
func ShouldBeTrue(actual interface{}, expected ...interface{}) string
ShouldBeTrue receives a single parameter and ensures that it is true.
func ShouldBeZeroValue ¶
func ShouldBeZeroValue(actual interface{}, expected ...interface{}) string
ShouldBeZeroValue receives a single parameter and ensures that it is the Go equivalent of the default value, or "zero" value.
func ShouldContain ¶
func ShouldContain(actual interface{}, expected ...interface{}) string
ShouldContain receives exactly two parameters. The first is a slice and the second is a proposed member. Membership is determined using ShouldEqual.
func ShouldContainModuloWhiteSpace ¶
func ShouldContainModuloWhiteSpace(haystack interface{}, expectedNeedle ...interface{}) string
func ShouldContainSubstring ¶
func ShouldContainSubstring(actual interface{}, expected ...interface{}) string
ShouldContainSubstring receives exactly 2 string parameters and ensures that the first contains the second as a substring.
func ShouldEndWith ¶
func ShouldEndWith(actual interface{}, expected ...interface{}) string
ShouldEndWith receives exactly 2 string parameters and ensures that the first ends with the second.
func ShouldEqual ¶
func ShouldEqual(actual interface{}, expected ...interface{}) string
ShouldEqual receives exactly two parameters and does an equality check.
func ShouldHappenAfter ¶
func ShouldHappenAfter(actual interface{}, expected ...interface{}) string
ShouldHappenAfter receives exactly 2 time.Time arguments and asserts that the first happens after the second.
func ShouldHappenBefore ¶
func ShouldHappenBefore(actual interface{}, expected ...interface{}) string
ShouldHappenBefore receives exactly 2 time.Time arguments and asserts that the first happens before the second.
func ShouldHappenBetween ¶
func ShouldHappenBetween(actual interface{}, expected ...interface{}) string
ShouldHappenBetween receives exactly 3 time.Time arguments and asserts that the first happens between (not on) the second and third.
func ShouldHappenOnOrAfter ¶
func ShouldHappenOnOrAfter(actual interface{}, expected ...interface{}) string
ShouldHappenOnOrAfter receives exactly 2 time.Time arguments and asserts that the first happens on or after the second.
func ShouldHappenOnOrBefore ¶
func ShouldHappenOnOrBefore(actual interface{}, expected ...interface{}) string
ShouldHappenOnOrBefore receives exactly 2 time.Time arguments and asserts that the first happens on or before the second.
func ShouldHappenOnOrBetween ¶
func ShouldHappenOnOrBetween(actual interface{}, expected ...interface{}) string
ShouldHappenOnOrBetween receives exactly 3 time.Time arguments and asserts that the first happens between or on the second and third.
func ShouldHappenWithin ¶
func ShouldHappenWithin(actual interface{}, expected ...interface{}) string
ShouldHappenWithin receives a time.Time, a time.Duration, and a time.Time (3 arguments) and asserts that the first time.Time happens within or on the duration specified relative to the other time.Time.
func ShouldHaveSameTypeAs ¶
func ShouldHaveSameTypeAs(actual interface{}, expected ...interface{}) string
ShouldHaveSameTypeAs receives exactly two parameters and compares their underlying types for equality.
func ShouldImplement ¶
func ShouldImplement(actual interface{}, expectedList ...interface{}) string
ShouldImplement receives exactly two parameters and ensures that the first implements the interface type of the second.
func ShouldMatchModulo ¶
ShouldMatchModulo receives exactly two string parameters and an ignore map. It ensures that the order of not-ignored characters in the two strings is identical. Runes specified in the ignore map are ignored for the purposes of this string comparison, and each should map to true. ShouldMatchModulo thus allows you to do whitespace insensitive comparison, which is very useful in lexer/parser work.
func ShouldMatchModuloSpaces ¶
func ShouldMatchModuloSpaces(actual interface{}, expected ...interface{}) string
ShouldMatchModuloSpaces compares two strings but ignores ' ' spaces. Serves as an example of use of ShouldMatchModulo.
func ShouldMatchModuloWhiteSpace ¶
func ShouldMatchModuloWhiteSpace(actual interface{}, expected ...interface{}) string
func ShouldMatchModuloWhiteSpaceAndComments ¶
func ShouldMatchModuloWhiteSpaceAndComments( commentStart string, actual interface{}, expected ...interface{}, ) string
comments from commentStart (e.g. "//" for Go, or "--" for Lua) to end of line "\n", are removed before comparison. No provision is made to account for commentStart within quoted strings. Multiline comments are not treated.
func ShouldMatchModuloWhiteSpaceAndGolangComments ¶
func ShouldMatchModuloWhiteSpaceAndGolangComments(actual interface{}, expected ...interface{}) string
func ShouldMatchModuloWhiteSpaceAndLuaComments ¶
func ShouldMatchModuloWhiteSpaceAndLuaComments(actual interface{}, expected ...interface{}) string
func ShouldMatchRegex ¶
func ShouldMatchRegex(actual interface{}, expected ...interface{}) string
func ShouldNotAlmostEqual ¶
func ShouldNotAlmostEqual(actual interface{}, expected ...interface{}) string
ShouldNotAlmostEqual is the inverse of ShouldAlmostEqual
func ShouldNotBeBetween ¶
func ShouldNotBeBetween(actual interface{}, expected ...interface{}) string
ShouldNotBeBetween receives exactly three parameters: an actual value, a lower bound, and an upper bound. It ensures that the actual value is NOT between both bounds.
func ShouldNotBeBetweenOrEqual ¶
func ShouldNotBeBetweenOrEqual(actual interface{}, expected ...interface{}) string
ShouldNotBeBetweenOrEqual receives exactly three parameters: an actual value, a lower bound, and an upper bound. It ensures that the actual value is nopt between the bounds nor equal to either of them.
func ShouldNotBeBlank ¶
func ShouldNotBeBlank(actual interface{}, expected ...interface{}) string
ShouldNotBeBlank receives exactly 1 string parameter and ensures that it is equal to "".
func ShouldNotBeEmpty ¶
func ShouldNotBeEmpty(actual interface{}, expected ...interface{}) string
ShouldNotBeEmpty receives a single parameter (actual) and determines whether or not calling len(actual) would return a value greater than zero. It obeys the rules specified by the `len` function for determining length: http://golang.org/pkg/builtin/#len
func ShouldNotBeIn ¶
func ShouldNotBeIn(actual interface{}, expected ...interface{}) string
ShouldNotBeIn receives at least 2 parameters. The first is a proposed member of the collection that is passed in either as the second parameter, or of the collection that is comprised of all the remaining parameters. This assertion ensures that the proposed member is NOT in the collection (using ShouldEqual).
func ShouldNotBeNil ¶
func ShouldNotBeNil(actual interface{}, expected ...interface{}) string
ShouldNotBeNil receives a single parameter and ensures that it is not nil.
func ShouldNotContain ¶
func ShouldNotContain(actual interface{}, expected ...interface{}) string
ShouldNotContain receives exactly two parameters. The first is a slice and the second is a proposed member. Membership is determinied using ShouldEqual.
func ShouldNotContainSubstring ¶
func ShouldNotContainSubstring(actual interface{}, expected ...interface{}) string
ShouldNotContainSubstring receives exactly 2 string parameters and ensures that the first does NOT contain the second as a substring.
func ShouldNotEndWith ¶
func ShouldNotEndWith(actual interface{}, expected ...interface{}) string
ShouldEndWith receives exactly 2 string parameters and ensures that the first does not end with the second.
func ShouldNotEqual ¶
func ShouldNotEqual(actual interface{}, expected ...interface{}) string
ShouldNotEqual receives exactly two parameters and does an inequality check.
func ShouldNotHappenOnOrBetween ¶
func ShouldNotHappenOnOrBetween(actual interface{}, expected ...interface{}) string
ShouldNotHappenOnOrBetween receives exactly 3 time.Time arguments and asserts that the first does NOT happen between or on the second or third.
func ShouldNotHappenWithin ¶
func ShouldNotHappenWithin(actual interface{}, expected ...interface{}) string
ShouldNotHappenWithin receives a time.Time, a time.Duration, and a time.Time (3 arguments) and asserts that the first time.Time does NOT happen within or on the duration specified relative to the other time.Time.
func ShouldNotHaveSameTypeAs ¶
func ShouldNotHaveSameTypeAs(actual interface{}, expected ...interface{}) string
ShouldNotHaveSameTypeAs receives exactly two parameters and compares their underlying types for inequality.
func ShouldNotImplement ¶
func ShouldNotImplement(actual interface{}, expectedList ...interface{}) string
ShouldNotImplement receives exactly two parameters and ensures that the first does NOT implement the interface type of the second.
func ShouldNotPanic ¶
func ShouldNotPanic(actual interface{}, expected ...interface{}) (message string)
ShouldNotPanic receives a void, niladic function and expects to execute the function without any panic.
func ShouldNotPanicWith ¶
func ShouldNotPanicWith(actual interface{}, expected ...interface{}) (message string)
ShouldNotPanicWith receives a void, niladic function and expects to recover a panic whose content differs from the second argument.
func ShouldNotPointTo ¶
func ShouldNotPointTo(actual interface{}, expected ...interface{}) string
ShouldNotPointTo receives exactly two parameters and checks to see that they point to different addresess.
func ShouldNotResemble ¶
func ShouldNotResemble(actual interface{}, expected ...interface{}) string
ShouldNotResemble receives exactly two parameters and does an inverse deep equal check (see reflect.DeepEqual)
func ShouldNotStartWith ¶
func ShouldNotStartWith(actual interface{}, expected ...interface{}) string
ShouldNotStartWith receives exactly 2 string parameters and ensures that the first does not start with the second.
func ShouldPanic ¶
func ShouldPanic(actual interface{}, expected ...interface{}) (message string)
ShouldPanic receives a void, niladic function and expects to recover a panic.
func ShouldPanicWith ¶
func ShouldPanicWith(actual interface{}, expected ...interface{}) (message string)
ShouldPanicWith receives a void, niladic function and expects to recover a panic with the second argument as the content.
func ShouldPointTo ¶
func ShouldPointTo(actual interface{}, expected ...interface{}) string
ShouldPointTo receives exactly two parameters and checks to see that they point to the same address.
func ShouldResemble ¶
func ShouldResemble(actual interface{}, expected ...interface{}) string
ShouldResemble receives exactly two parameters and does a deep equal check (see reflect.DeepEqual)
func ShouldStartWith ¶
func ShouldStartWith(actual interface{}, expected ...interface{}) string
ShouldStartWith receives exactly 2 string parameters and ensures that the first starts with the second.
func ShouldStartWithModuloWhiteSpace ¶
func ShouldStartWithModuloWhiteSpace(actual interface{}, expectedPrefix ...interface{}) string
func ShouldStartWithModuloWhiteSpaceAndGolangComments ¶
func ShouldStartWithModuloWhiteSpaceAndGolangComments(actual interface{}, expected ...interface{}) string
func ShouldStartWithModuloWhiteSpaceAndLuaComments ¶
func ShouldStartWithModuloWhiteSpaceAndLuaComments(actual interface{}, expected ...interface{}) string
func SimpleTempFile ¶
Types ¶
type Serializer ¶
type Serializer interface {
// contains filtered or unexported methods
}
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package oglematchers provides a set of matchers useful in a testing or mocking framework.
|
Package oglematchers provides a set of matchers useful in a testing or mocking framework. |
createmock
createmock is used to generate source code for mock versions of interfaces from installed packages.
|
createmock is used to generate source code for mock versions of interfaces from installed packages. |
generate
Package generate implements code generation for mock classes.
|
Package generate implements code generation for mock classes. |
generate/test_cases/complicated_pkg
Package complicated_pkg contains an interface with lots of interesting cases, for use in integration testing.
|
Package complicated_pkg contains an interface with lots of interesting cases, for use in integration testing. |
generate/test_cases/renamed_pkg
A package that calls itself something different than its package path would have you believe.
|
A package that calls itself something different than its package path would have you believe. |
Package ogletest provides a framework for writing expressive unit tests.
|
Package ogletest provides a framework for writing expressive unit tests. |