7 "github.com/onsi/gomega/format"
10 type BeAnExistingFileMatcher struct {
14 func (matcher *BeAnExistingFileMatcher) Match(actual interface{}) (success bool, err error) {
15 actualFilename, ok := actual.(string)
17 return false, fmt.Errorf("BeAnExistingFileMatcher matcher expects a file path")
20 if _, err = os.Stat(actualFilename); err != nil {
22 case os.IsNotExist(err):
32 func (matcher *BeAnExistingFileMatcher) FailureMessage(actual interface{}) (message string) {
33 return format.Message(actual, fmt.Sprintf("to exist"))
36 func (matcher *BeAnExistingFileMatcher) NegatedFailureMessage(actual interface{}) (message string) {
37 return format.Message(actual, fmt.Sprintf("not to exist"))