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

Method Last

array.go:326–346  ·  view source on GitHub ↗

Deprecated: use Value or HasValue instead.

()

Source from the content-addressed store, hash-verified

324
325// Deprecated: use Value or HasValue instead.
326func (a *Array) Last() *Value {
327 opChain := a.chain.enter("Last()")
328 defer opChain.leave()
329
330 if opChain.failed() {
331 return newValue(opChain, nil)
332 }
333
334 if len(a.value) == 0 {
335 opChain.fail(AssertionFailure{
336 Type: AssertNotEmpty,
337 Actual: &AssertionValue{a.value},
338 Errors: []error{
339 errors.New("expected: non-empty array"),
340 },
341 })
342 return newValue(opChain, nil)
343 }
344
345 return newValue(opChain, a.value[len(a.value)-1])
346}
347
348// Iter returns a new slice of Values attached to array elements.
349//

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