(tail *Tail, lines []string)
| 488 | } |
| 489 | |
| 490 | func (t TailTest) ReadLines(tail *Tail, lines []string) { |
| 491 | for idx, line := range lines { |
| 492 | tailedLine, ok := <-tail.Lines |
| 493 | if !ok { |
| 494 | // tail.Lines is closed and empty. |
| 495 | err := tail.Err() |
| 496 | if err != nil { |
| 497 | t.Fatalf("tail ended with error: %v", err) |
| 498 | } |
| 499 | t.Fatalf("tail ended early; expecting more: %v", lines[idx:]) |
| 500 | } |
| 501 | if tailedLine == nil { |
| 502 | t.Fatalf("tail.Lines returned nil; not possible") |
| 503 | } |
| 504 | // Note: not checking .Err as the `lines` argument is designed |
| 505 | // to match error strings as well. |
| 506 | if tailedLine.Text != line { |
| 507 | t.Fatalf( |
| 508 | "unexpected line/err from tail: "+ |
| 509 | "expecting <<%s>>>, but got <<<%s>>>", |
| 510 | line, tailedLine.Text) |
| 511 | } |
| 512 | } |
| 513 | } |
| 514 | |
| 515 | func (t TailTest) Cleanup(tail *Tail, stop bool) { |
| 516 | <-t.done |
no test coverage detected