Jump straight to the [docs](http://onsi.github.io/gomega/) to learn about Gomega, including a list of [all available matchers](http://onsi.github.io/gomega/#provided-matchers).
Jump straight to the [docs](http://onsi.github.io/gomega/) to learn about Gomega, including a list of [all available matchers](http://onsi.github.io/gomega/#provided-matchers).
// Ω wraps an actual value allowing assertions to be made on it:
// Ω wraps an actual value allowing assertions to be made on it:
// Ω("foo").Should(Equal("foo"))
// Ω("foo").Should(Equal("foo"))
//
//
...
@@ -177,7 +204,7 @@ func ExpectWithOffset(offset int, actual interface{}, extra ...interface{}) Asse
...
@@ -177,7 +204,7 @@ func ExpectWithOffset(offset int, actual interface{}, extra ...interface{}) Asse
// Both intervals can either be specified as time.Duration, parsable duration strings or as floats/integers. In the
// Both intervals can either be specified as time.Duration, parsable duration strings or as floats/integers. In the
// last case they are interpreted as seconds.
// last case they are interpreted as seconds.
//
//
// If Eventually is passed an actual that is a function taking no arguments and returning at least one value,
// If Eventually is passed an actual that is a function taking no arguments,
// then Eventually will call the function periodically and try the matcher against the function's first return value.
// then Eventually will call the function periodically and try the matcher against the function's first return value.
//
//
// Example:
// Example:
...
@@ -202,6 +229,34 @@ func ExpectWithOffset(offset int, actual interface{}, extra ...interface{}) Asse
...
@@ -202,6 +229,34 @@ func ExpectWithOffset(offset int, actual interface{}, extra ...interface{}) Asse
//
//
// Will pass only if the the returned error is nil and the returned string passes the matcher.
// Will pass only if the the returned error is nil and the returned string passes the matcher.
//
//
// Eventually allows you to make assertions in the pased-in function. The function is assumed to have failed and will be retried if any assertion in the function fails.
// will keep trying the passed-in function until all its assertsions pass (i.e. the http request succeeds) _and_ the returned object satisfies the passed-in matcher.
//
// Functions passed to Eventually typically have a return value. However you are allowed to pass in a function with no return value. Eventually assumes such a function
// is making assertions and will turn it into a function that returns an error if any assertion fails, or nil if no assertion fails. This allows you to use the Succeed() matcher
// to express that a complex operation should eventually succeed. For example:
//
// Eventually(func() {
// model, err := db.Find("foo")
// Expect(err).NotTo(HaveOccurred())
// Expect(model.Reticulated()).To(BeTrue())
// Expect(model.Save()).To(Succeed())
// }).Should(Succeed())
//
// will rerun the function until all its assertions pass.
//
// Eventually's default timeout is 1 second, and its default polling interval is 10ms
// Eventually's default timeout is 1 second, and its default polling interval is 10ms
// Both intervals can either be specified as time.Duration, parsable duration strings or as floats/integers. In the
// Both intervals can either be specified as time.Duration, parsable duration strings or as floats/integers. In the
// last case they are interpreted as seconds.
// last case they are interpreted as seconds.
//
//
// If Consistently is passed an actual that is a function taking no arguments and returning at least one value,
// If Consistently is passed an actual that is a function taking no arguments.
// then Consistently will call the function periodically and try the matcher against the function's first return value.
//
// If the function returns one value, then Consistently will call the function periodically and try the matcher against the function's first return value.
//
//
// If the function returns more than one value, then Consistently will pass the first value to the matcher and
// If the function returns more than one value, then Consistently will pass the first value to the matcher and
// assert that all other values are nil/zero.
// assert that all other values are nil/zero.
// This allows you to pass Consistently a function that returns a value and an error - a common pattern in Go.
// This allows you to pass Consistently a function that returns a value and an error - a common pattern in Go.
//
//
// Like Eventually, Consistently allows you to make assertions in the function. If any assertion fails Consistently will fail. In addition,
// Consistently also allows you to pass in a function with no return value. In this case Consistently can be paired with the Succeed() matcher to assert
// that no assertions in the function fail.
//
// Consistently is useful in cases where you want to assert that something *does not happen* over a period of time.
// Consistently is useful in cases where you want to assert that something *does not happen* over a period of time.
// For example, you want to assert that a goroutine does *not* send data down a channel. In this case, you could:
// For example, you want to assert that a goroutine does *not* send data down a channel. In this case, you could:
//
//
...
@@ -350,7 +410,7 @@ type OmegaMatcher types.GomegaMatcher
...
@@ -350,7 +410,7 @@ type OmegaMatcher types.GomegaMatcher
//
//
// Use `NewWithT` to instantiate a `WithT`
// Use `NewWithT` to instantiate a `WithT`
typeWithTstruct{
typeWithTstruct{
ttypes.GomegaTestingT
failWrapper*types.GomegaFailWrapper
}
}
// GomegaWithT is deprecated in favor of gomega.WithT, which does not stutter.
// GomegaWithT is deprecated in favor of gomega.WithT, which does not stutter.