File: fake_matcher.go

package info (click to toggle)
golang-gomega 1.0%2Bgit20160910.d59fa0a-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 728 kB
  • ctags: 691
  • sloc: makefile: 12
file content (23 lines) | stat: -rw-r--r-- 542 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package fakematcher

import "fmt"

type FakeMatcher struct {
	ReceivedActual  interface{}
	MatchesToReturn bool
	ErrToReturn     error
}

func (matcher *FakeMatcher) Match(actual interface{}) (bool, error) {
	matcher.ReceivedActual = actual

	return matcher.MatchesToReturn, matcher.ErrToReturn
}

func (matcher *FakeMatcher) FailureMessage(actual interface{}) string {
	return fmt.Sprintf("positive: %v", actual)
}

func (matcher *FakeMatcher) NegatedFailureMessage(actual interface{}) string {
	return fmt.Sprintf("negative: %v", actual)
}