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

Method First

array.go:303–323  ·  view source on GitHub ↗

Deprecated: use Value or HasValue instead.

()

Source from the content-addressed store, hash-verified

301
302// Deprecated: use Value or HasValue instead.
303func (a *Array) First() *Value {
304 opChain := a.chain.enter("First()")
305 defer opChain.leave()
306
307 if opChain.failed() {
308 return newValue(opChain, nil)
309 }
310
311 if len(a.value) == 0 {
312 opChain.fail(AssertionFailure{
313 Type: AssertNotEmpty,
314 Actual: &AssertionValue{a.value},
315 Errors: []error{
316 errors.New("expected: non-empty array"),
317 },
318 })
319 return newValue(opChain, nil)
320 }
321
322 return newValue(opChain, a.value[0])
323}
324
325// Deprecated: use Value or HasValue instead.
326func (a *Array) Last() *Value {

Callers 1

TestArray_FailedChainFunction · 0.80

Calls 5

newValueFunction · 0.85
enterMethod · 0.80
leaveMethod · 0.80
failedMethod · 0.80
failMethod · 0.80

Tested by 1

TestArray_FailedChainFunction · 0.64