MCPcopy Index your code
hub / github.com/gavv/httpexpect / NotEqual

Method NotEqual

value.go:792–817  ·  view source on GitHub ↗

NotEqual succeeds if value is not equal to another value (e.g. map, slice, string, etc). Before comparison, both values are converted to canonical form. Example: value := NewValue(t, "foo") value.NorEqual("bar")

(value interface{})

Source from the content-addressed store, hash-verified

790// value := NewValue(t, "foo")
791// value.NorEqual("bar")
792func (v *Value) NotEqual(value interface{}) *Value {
793 opChain := v.chain.enter("NotEqual()")
794 defer opChain.leave()
795
796 if opChain.failed() {
797 return v
798 }
799
800 expected, ok := canonValue(opChain, value)
801 if !ok {
802 return v
803 }
804
805 if reflect.DeepEqual(expected, v.value) {
806 opChain.fail(AssertionFailure{
807 Type: AssertNotEqual,
808 Actual: &AssertionValue{v.value},
809 Expected: &AssertionValue{expected},
810 Errors: []error{
811 errors.New("expected: values are non-equal"),
812 },
813 })
814 }
815
816 return v
817}
818
819// Deprecated: use IsEqual instead.
820func (v *Value) Equal(value interface{}) *Value {

Callers 15

TestFormatter_FormatDiffFunction · 0.45
TestDuration_FailedChainFunction · 0.45
TestDuration_IsEqualFunction · 0.45
TestBodyWrapper_RewindFunction · 0.45
TestBodyWrapper_GetBodyFunction · 0.45
TestNumber_FailedChainFunction · 0.45
TestNumber_IsEqualFunction · 0.45
TestString_FailedChainFunction · 0.45
TestString_IsEqualFunction · 0.45
assertMethod · 0.45

Calls 5

canonValueFunction · 0.85
enterMethod · 0.80
leaveMethod · 0.80
failedMethod · 0.80
failMethod · 0.80

Tested by 15

TestFormatter_FormatDiffFunction · 0.36
TestDuration_FailedChainFunction · 0.36
TestDuration_IsEqualFunction · 0.36
TestBodyWrapper_RewindFunction · 0.36
TestBodyWrapper_GetBodyFunction · 0.36
TestNumber_FailedChainFunction · 0.36
TestNumber_IsEqualFunction · 0.36
TestString_FailedChainFunction · 0.36
TestString_IsEqualFunction · 0.36