NotContainsKey succeeds if object doesn't contain given key. Example: object := NewObject(t, map[string]interface{}{"foo": 123}) object.NotContainsKey("bar")
(key string)
| 1024 | // object := NewObject(t, map[string]interface{}{"foo": 123}) |
| 1025 | // object.NotContainsKey("bar") |
| 1026 | func (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. |