(t *testing.T)
| 669 | } |
| 670 | |
| 671 | func TestTextParserStartOfLine(t *testing.T) { |
| 672 | t.Run("EOF", func(t *testing.T) { |
| 673 | p := TextParser{} |
| 674 | in := strings.NewReader("") |
| 675 | p.reset(in) |
| 676 | fn := p.startOfLine() |
| 677 | if fn != nil { |
| 678 | t.Errorf("Unexpected non-nil function: %v", fn) |
| 679 | } |
| 680 | if p.err != nil { |
| 681 | t.Errorf("Unexpected error: %v", p.err) |
| 682 | } |
| 683 | }) |
| 684 | |
| 685 | t.Run("OtherError", func(t *testing.T) { |
| 686 | p := TextParser{} |
| 687 | in := &errReader{err: errors.New("unexpected error")} |
| 688 | p.reset(in) |
| 689 | fn := p.startOfLine() |
| 690 | if fn != nil { |
| 691 | t.Errorf("Unexpected non-nil function: %v", fn) |
| 692 | } |
| 693 | if p.err != nil && !errors.Is(p.err, in.err) { |
| 694 | t.Errorf("Unexpected error: %v, expected %v", p.err, in.err) |
| 695 | } |
| 696 | }) |
| 697 | } |
| 698 | |
| 699 | type errReader struct { |
| 700 | err error |
nothing calls this directly
no test coverage detected