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

Method NotContainsKey

object.go:1026–1046  ·  view source on GitHub ↗

NotContainsKey succeeds if object doesn't contain given key. Example: object := NewObject(t, map[string]interface{}{"foo": 123}) object.NotContainsKey("bar")

(key string)

Source from the content-addressed store, hash-verified

1024// object := NewObject(t, map[string]interface{}{"foo": 123})
1025// object.NotContainsKey("bar")
1026func (o *Object) NotContainsKey(key string) *Object {
1027 opChain := o.chain.enter("NotContainsKey()")
1028 defer opChain.leave()
1029
1030 if opChain.failed() {
1031 return o
1032 }
1033
1034 if containsKey(opChain, o.value, key) {
1035 opChain.fail(AssertionFailure{
1036 Type: AssertNotContainsKey,
1037 Actual: &AssertionValue{o.value},
1038 Expected: &AssertionValue{key},
1039 Errors: []error{
1040 errors.New("expected: map does not contain key"),
1041 },
1042 })
1043 }
1044
1045 return o
1046}
1047
1048// ContainsValue succeeds if object contains given value with any key.
1049// Before comparison, both object and value are converted to canonical form.

Callers 2

TestObject_FailedChainFunction · 0.80
TestObject_ContainsKeyFunction · 0.80

Calls 5

containsKeyFunction · 0.85
enterMethod · 0.80
leaveMethod · 0.80
failedMethod · 0.80
failMethod · 0.80

Tested by 2

TestObject_FailedChainFunction · 0.64
TestObject_ContainsKeyFunction · 0.64