Exemple #1
0
func (matcher *HaveKeyMatcher) NegatedFailureMessage(actual interface{}) (message string) {
	switch matcher.Key.(type) {
	case omegaMatcher:
		return format.Message(actual, "not to have key matching", matcher.Key)
	default:
		return format.Message(actual, "not to have key", matcher.Key)
	}
}
Exemple #2
0
func (m *exitMatcher) FailureMessage(actual interface{}) (message string) {
	if m.actualExitCode == -1 {
		return "Expected process to exit.  It did not."
	} else {
		return format.Message(m.actualExitCode, "to match exit code:", m.exitCode)
	}
}
Exemple #3
0
func (m *exitMatcher) NegatedFailureMessage(actual interface{}) (message string) {
	if m.actualExitCode == -1 {
		return "you really shouldn't be able to see this!"
	} else {
		if m.exitCode == -1 {
			return "Expected process not to exit.  It did."
		} else {
			return format.Message(m.actualExitCode, "not to match exit code:", m.exitCode)
		}
	}
}
Exemple #4
0
func (matcher *ReceiveMatcher) NegatedFailureMessage(actual interface{}) (message string) {
	subMatcher, hasSubMatcher := (matcher.Arg).(omegaMatcher)

	if hasSubMatcher {
		if matcher.receivedValue.IsValid() {
			return subMatcher.NegatedFailureMessage(matcher.receivedValue.Interface())
		}
		return "When passed a matcher, ReceiveMatcher's channel *must* receive something."
	} else {
		return format.Message(actual, "not to receive anything")
	}
}
func (matcher *HaveKeyWithValueMatcher) FailureMessage(actual interface{}) (message string) {
	str := "to have {key: value}"
	if _, ok := matcher.Key.(omegaMatcher); ok {
		str += " matching"
	} else if _, ok := matcher.Value.(omegaMatcher); ok {
		str += " matching"
	}

	expect := make(map[interface{}]interface{}, 1)
	expect[matcher.Key] = matcher.Value
	return format.Message(actual, str, expect)
}
func (matcher *HaveKeyWithValueMatcher) NegatedFailureMessage(actual interface{}) (message string) {
	kStr := "not to have key"
	if _, ok := matcher.Key.(omegaMatcher); ok {
		kStr = "not to have key matching"
	}

	vStr := "or that key's value not be"
	if _, ok := matcher.Value.(omegaMatcher); ok {
		vStr = "or to have that key's value not matching"
	}

	return format.Message(actual, kStr, matcher.Key, vStr, matcher.Value)
}
func (matcher *BeNumericallyMatcher) NegatedFailureMessage(actual interface{}) (message string) {
	return format.Message(actual, fmt.Sprintf("not to be %s", matcher.Comparator), matcher.CompareTo[0])
}
Exemple #8
0
func (matcher *EqualMatcher) NegatedFailureMessage(actual interface{}) (message string) {
	return format.Message(actual, "not to equal", matcher.Expected)
}
Exemple #9
0
func (matcher *BeZeroMatcher) NegatedFailureMessage(actual interface{}) (message string) {
	return format.Message(actual, "not to be zero-valued")
}
Exemple #10
0
func (matcher *BeClosedMatcher) NegatedFailureMessage(actual interface{}) (message string) {
	return format.Message(actual, "to be open")
}
func (matcher *BeEquivalentToMatcher) NegatedFailureMessage(actual interface{}) (message string) {
	return format.Message(actual, "not to be equivalent to", matcher.Expected)
}
Exemple #12
0
func (matcher *BeEmptyMatcher) NegatedFailureMessage(actual interface{}) (message string) {
	return format.Message(actual, "not to be empty")
}
Exemple #13
0
func (matcher *ConsistOfMatcher) NegatedFailureMessage(actual interface{}) (message string) {
	return format.Message(actual, "not to consist of", matcher.Elements)
}
func (matcher *AssignableToTypeOfMatcher) NegatedFailureMessage(actual interface{}) string {
	return format.Message(actual, fmt.Sprintf("not to be assignable to the type: %T", matcher.Expected))
}
func (matcher *MatchRegexpMatcher) NegatedFailureMessage(actual interface{}) (message string) {
	return format.Message(actual, "not to match regular expression", matcher.regexp())
}
Exemple #16
0
func (matcher *PanicMatcher) NegatedFailureMessage(actual interface{}) (message string) {
	return format.Message(actual, "not to panic")
}
Exemple #17
0
func (matcher *BeTrueMatcher) FailureMessage(actual interface{}) (message string) {
	return format.Message(actual, "to be true")
}
func (matcher *MatchJSONMatcher) NegatedFailureMessage(actual interface{}) (message string) {
	actualString, expectedString, _ := matcher.prettyPrint(actual)
	return format.Message(actualString, "not to match JSON of", expectedString)
}
Exemple #19
0
func (matcher *BeNilMatcher) FailureMessage(actual interface{}) (message string) {
	return format.Message(actual, "to be nil")
}
Exemple #20
0
func (matcher *BeSentMatcher) NegatedFailureMessage(actual interface{}) (message string) {
	return format.Message(actual, "not to send:", matcher.Arg)
}
func (matcher *ContainSubstringMatcher) NegatedFailureMessage(actual interface{}) (message string) {
	return format.Message(actual, "not to contain substring", matcher.stringToMatch())
}
func (matcher *MatchErrorMatcher) NegatedFailureMessage(actual interface{}) (message string) {
	return format.Message(actual, "not to match error", matcher.Expected)
}
Exemple #23
0
func (matcher *BeFalseMatcher) NegatedFailureMessage(actual interface{}) (message string) {
	return format.Message(actual, "not to be false")
}
func (matcher *BeTemporallyMatcher) FailureMessage(actual interface{}) (message string) {
	return format.Message(actual, fmt.Sprintf("to be %s", matcher.Comparator), matcher.CompareTo)
}
Exemple #25
0
func (matcher *BeClosedMatcher) FailureMessage(actual interface{}) (message string) {
	return format.Message(actual, "to be closed")
}
func (matcher *ContainElementMatcher) NegatedFailureMessage(actual interface{}) (message string) {
	return format.Message(actual, "not to contain element matching", matcher.Element)
}