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

Method Keys

object.go:169–183  ·  view source on GitHub ↗

Keys returns a new Array instance with object's keys. Keys are sorted in ascending order. Example: object := NewObject(t, map[string]interface{}{"foo": 123, "bar": 456}) object.Keys().ContainsOnly("foo", "bar")

()

Source from the content-addressed store, hash-verified

167// object := NewObject(t, map[string]interface{}{"foo": 123, "bar": 456})
168// object.Keys().ContainsOnly("foo", "bar")
169func (o *Object) Keys() *Array {
170 opChain := o.chain.enter("Keys()")
171 defer opChain.leave()
172
173 if opChain.failed() {
174 return newArray(opChain, nil)
175 }
176
177 keys := []interface{}{}
178 for _, kv := range o.sortedKV() {
179 keys = append(keys, kv.key)
180 }
181
182 return newArray(opChain, keys)
183}
184
185// Values returns a new Array instance with object's values.
186// Values are sorted by keys ascending order.

Callers 5

TestObject_GettersFunction · 0.95
TestExpect_TraverseFunction · 0.80
TestObject_FailedChainFunction · 0.80
testEchoFunction · 0.80
TestFruitsFunction · 0.80

Calls 5

sortedKVMethod · 0.95
newArrayFunction · 0.85
enterMethod · 0.80
leaveMethod · 0.80
failedMethod · 0.80

Tested by 5

TestObject_GettersFunction · 0.76
TestExpect_TraverseFunction · 0.64
TestObject_FailedChainFunction · 0.64
testEchoFunction · 0.64
TestFruitsFunction · 0.64