(t *testing.T)
| 24 | ) |
| 25 | |
| 26 | func TestPush(t *testing.T) { |
| 27 | for c, test := range []struct { |
| 28 | max int |
| 29 | logs []string |
| 30 | expected string |
| 31 | }{ |
| 32 | { |
| 33 | max: 1, |
| 34 | logs: []string{"a", "b"}, |
| 35 | expected: "b", |
| 36 | }, |
| 37 | { |
| 38 | max: 2, |
| 39 | logs: []string{"a", "b"}, |
| 40 | expected: "a\nb", |
| 41 | }, |
| 42 | { |
| 43 | max: 2, |
| 44 | logs: []string{"a", "b", "c"}, |
| 45 | expected: "b\nc", |
| 46 | }, |
| 47 | { |
| 48 | max: 2, |
| 49 | logs: []string{"a", "b", "c", "d"}, |
| 50 | expected: "c\nd", |
| 51 | }, |
| 52 | } { |
| 53 | b := NewLogBuffer(test.max) |
| 54 | for _, log := range test.logs { |
| 55 | b.Push(&types.Log{Message: log}) |
| 56 | } |
| 57 | got := b.String() |
| 58 | if test.expected != got { |
| 59 | t.Errorf("case %d: expected %q, got %q", c+1, test.expected, got) |
| 60 | } |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | func TestMatch(t *testing.T) { |
| 65 | max := 4 |
nothing calls this directly
no test coverage detected