(t *testing.T)
| 1385 | } |
| 1386 | |
| 1387 | func TestTextParserStartOfLine(t *testing.T) { |
| 1388 | t.Run("EOF", func(t *testing.T) { |
| 1389 | p := NewTextParser(model.UTF8Validation) |
| 1390 | in := strings.NewReader("") |
| 1391 | p.reset(in) |
| 1392 | fn := p.startOfLine() |
| 1393 | if fn != nil { |
| 1394 | t.Errorf("Unexpected non-nil function: %v", fn) |
| 1395 | } |
| 1396 | if p.err != nil { |
| 1397 | t.Errorf("Unexpected error: %v", p.err) |
| 1398 | } |
| 1399 | }) |
| 1400 | |
| 1401 | t.Run("OtherError", func(t *testing.T) { |
| 1402 | p := NewTextParser(model.UTF8Validation) |
| 1403 | in := &errReader{err: errors.New("unexpected error")} |
| 1404 | p.reset(in) |
| 1405 | fn := p.startOfLine() |
| 1406 | if fn != nil { |
| 1407 | t.Errorf("Unexpected non-nil function: %v", fn) |
| 1408 | } |
| 1409 | if p.err != nil && !errors.Is(p.err, in.err) { |
| 1410 | t.Errorf("Unexpected error: %v, expected %v", p.err, in.err) |
| 1411 | } |
| 1412 | }) |
| 1413 | } |
| 1414 | |
| 1415 | type errReader struct { |
| 1416 | err error |
nothing calls this directly
no test coverage detected