MCPcopy Create free account
hub / github.com/gavv/httpexpect / Length

Method Length

match.go:98–107  ·  view source on GitHub ↗

Length returns a new Number instance with number of submatches. Example: m := NewMatch(t, submatches, names) m.Length().IsEqual(len(submatches))

()

Source from the content-addressed store, hash-verified

96// m := NewMatch(t, submatches, names)
97// m.Length().IsEqual(len(submatches))
98func (m *Match) Length() *Number {
99 opChain := m.chain.enter("Length()")
100 defer opChain.leave()
101
102 if opChain.failed() {
103 return newNumber(opChain, 0)
104 }
105
106 return newNumber(opChain, float64(len(m.submatchValues)))
107}
108
109// Submatch returns a new String instance with submatch for given index.
110//

Callers 6

TestMatch_GettersFunction · 0.95
TestMatch_FailedChainFunction · 0.45
TestString_FailedChainFunction · 0.45
TestArray_FailedChainFunction · 0.45
TestIrisRedirectFunction · 0.45
TestFruitsFunction · 0.45

Calls 4

newNumberFunction · 0.85
enterMethod · 0.80
leaveMethod · 0.80
failedMethod · 0.80

Tested by 6

TestMatch_GettersFunction · 0.76
TestMatch_FailedChainFunction · 0.36
TestString_FailedChainFunction · 0.36
TestArray_FailedChainFunction · 0.36
TestIrisRedirectFunction · 0.36
TestFruitsFunction · 0.36