NotEmpty succeeds if submatches array is non-empty. Example: m := NewMatch(t, submatches, names) m.NotEmpty()
()
| 235 | // m := NewMatch(t, submatches, names) |
| 236 | // m.NotEmpty() |
| 237 | func (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. |
| 259 | func (m *Match) Empty() *Match { |