3 import "github.com/onsi/gomega/types"
6 GomegaMatchers that also match the OracleMatcher interface can convey information about
7 whether or not their result will change upon future attempts.
9 This allows `Eventually` and `Consistently` to short circuit if success becomes impossible.
11 For example, a process' exit code can never change. So, gexec's Exit matcher returns `true`
12 for `MatchMayChangeInTheFuture` until the process exits, at which point it returns `false` forevermore.
14 type OracleMatcher interface {
15 MatchMayChangeInTheFuture(actual interface{}) bool
18 func MatchMayChangeInTheFuture(matcher types.GomegaMatcher, value interface{}) bool {
19 oracleMatcher, ok := matcher.(OracleMatcher)
24 return oracleMatcher.MatchMayChangeInTheFuture(value)