(t *testing.T)
| 1415 | } |
| 1416 | |
| 1417 | func TestTextParserStartOfLine(t *testing.T) { |
| 1418 | t.Run("EOF", func(t *testing.T) { |
| 1419 | p := NewTextParser(model.UTF8Validation) |
| 1420 | in := strings.NewReader("") |
| 1421 | p.reset(in) |
| 1422 | fn := p.startOfLine() |
| 1423 | if fn != nil { |
| 1424 | t.Errorf("Unexpected non-nil function: %v", fn) |
| 1425 | } |
| 1426 | if p.err != nil { |
| 1427 | t.Errorf("Unexpected error: %v", p.err) |
| 1428 | } |
| 1429 | }) |
| 1430 | |
| 1431 | t.Run("OtherError", func(t *testing.T) { |
| 1432 | p := NewTextParser(model.UTF8Validation) |
| 1433 | in := &errReader{err: errors.New("unexpected error")} |
| 1434 | p.reset(in) |
| 1435 | fn := p.startOfLine() |
| 1436 | if fn != nil { |
| 1437 | t.Errorf("Unexpected non-nil function: %v", fn) |
| 1438 | } |
| 1439 | if p.err != nil && !errors.Is(p.err, in.err) { |
| 1440 | t.Errorf("Unexpected error: %v, expected %v", p.err, in.err) |
| 1441 | } |
| 1442 | }) |
| 1443 | } |
| 1444 | |
| 1445 | type errReader struct { |
| 1446 | err error |
nothing calls this directly
no test coverage detected