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

Method NotEmpty

match.go:237–256  ·  view source on GitHub ↗

NotEmpty succeeds if submatches array is non-empty. Example: m := NewMatch(t, submatches, names) m.NotEmpty()

()

Source from the content-addressed store, hash-verified

235// m := NewMatch(t, submatches, names)
236// m.NotEmpty()
237func (m *Match) NotEmpty() *Match {
238 opChain := m.chain.enter("NotEmpty()")
239 defer opChain.leave()
240
241 if opChain.failed() {
242 return m
243 }
244
245 if !(len(m.submatchValues) != 0) {
246 opChain.fail(AssertionFailure{
247 Type: AssertNotEmpty,
248 Actual: &AssertionValue{m.submatchValues},
249 Errors: []error{
250 errors.New("expected: non-empty sub-match list"),
251 },
252 })
253 }
254
255 return m
256}
257
258// Deprecated: use IsEmpty instead.
259func (m *Match) Empty() *Match {

Callers 15

TestMatch_FailedChainFunction · 0.45
TestMatch_IsEmptyFunction · 0.45
TestString_FailedChainFunction · 0.45
TestString_IsEmptyFunction · 0.45
TestArray_FailedChainFunction · 0.45
TestArray_IsEmptyFunction · 0.45
TestArray_EveryFunction · 0.45
TestArray_FilterFunction · 0.45
TestArray_FindFunction · 0.45
TestArray_NotFindFunction · 0.45
TestAssertion_StringsFunction · 0.45

Calls 4

enterMethod · 0.80
leaveMethod · 0.80
failedMethod · 0.80
failMethod · 0.80

Tested by 15

TestMatch_FailedChainFunction · 0.36
TestMatch_IsEmptyFunction · 0.36
TestString_FailedChainFunction · 0.36
TestString_IsEmptyFunction · 0.36
TestArray_FailedChainFunction · 0.36
TestArray_IsEmptyFunction · 0.36
TestArray_EveryFunction · 0.36
TestArray_FilterFunction · 0.36
TestArray_FindFunction · 0.36
TestArray_NotFindFunction · 0.36
TestAssertion_StringsFunction · 0.36