LEFT | RIGHT |
1 // Copyright 2013 Canonical Ltd. | 1 // Copyright 2013 Canonical Ltd. |
2 // Licensed under the AGPLv3, see LICENCE file for details. | 2 // Licensed under the AGPLv3, see LICENCE file for details. |
3 | 3 |
4 package tailer_test | 4 package tailer_test |
5 | 5 |
6 import ( | 6 import ( |
7 "bufio" | 7 "bufio" |
8 "bytes" | 8 "bytes" |
9 "fmt" | 9 "fmt" |
10 "io" | 10 "io" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 "yankee yankee\n", | 54 "yankee yankee\n", |
55 "zulu zulu\n", | 55 "zulu zulu\n", |
56 } | 56 } |
57 | 57 |
58 var tests = []struct { | 58 var tests = []struct { |
59 description string | 59 description string |
60 data []string | 60 data []string |
61 initialLinesWritten int | 61 initialLinesWritten int |
62 initialLinesRequested int | 62 initialLinesRequested int |
63 bufferSize int | 63 bufferSize int |
64 » filter tailer.TailerFilterFunc | 64 » filter tailer.FilterFunc |
65 injector func(*tailer.Tailer, *readSeeker) func([]string) | 65 injector func(*tailer.Tailer, *readSeeker) func([]string) |
66 initialCollectedData []string | 66 initialCollectedData []string |
67 appendedCollectedData []string | 67 appendedCollectedData []string |
68 err string | 68 err string |
69 }{{ | 69 }{{ |
70 description: "lines are longer than buffer size", | 70 description: "lines are longer than buffer size", |
71 data: []string{ | 71 data: []string{ |
72 "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\n", | 72 "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\n", |
73 "0123456789012345678901234567890123456789012345678901\n", | 73 "0123456789012345678901234567890123456789012345678901\n", |
74 }, | 74 }, |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 } | 498 } |
499 if newPos < 0 { | 499 if newPos < 0 { |
500 return 0, fmt.Errorf("negative position: %d", newPos) | 500 return 0, fmt.Errorf("negative position: %d", newPos) |
501 } | 501 } |
502 if newPos >= 1<<31 { | 502 if newPos >= 1<<31 { |
503 return 0, fmt.Errorf("position out of range: %d", newPos) | 503 return 0, fmt.Errorf("position out of range: %d", newPos) |
504 } | 504 } |
505 r.pos = int(newPos) | 505 r.pos = int(newPos) |
506 return newPos, nil | 506 return newPos, nil |
507 } | 507 } |
LEFT | RIGHT |