(t *testing.T)
| 19 | ) |
| 20 | |
| 21 | func TestProcessLine(t *testing.T) { |
| 22 | for _, tc := range []struct { |
| 23 | line string |
| 24 | want *Todo |
| 25 | }{ |
| 26 | { |
| 27 | line: "// TODO(foobar.com/issue/123): comment, bla. blabla.", |
| 28 | want: &Todo{ |
| 29 | Issue: "foobar.com/issue/123", |
| 30 | Locations: []Location{ |
| 31 | {Comment: "comment, bla. blabla."}, |
| 32 | }, |
| 33 | }, |
| 34 | }, |
| 35 | { |
| 36 | line: "// TODO(foobar.com/issues/123): comment, bla. blabla.", |
| 37 | want: &Todo{ |
| 38 | Issue: "foobar.com/issues/123", |
| 39 | Locations: []Location{ |
| 40 | {Comment: "comment, bla. blabla."}, |
| 41 | }, |
| 42 | }, |
| 43 | }, |
| 44 | { |
| 45 | line: "// FIXME(b/123): internal bug", |
| 46 | want: &Todo{ |
| 47 | Issue: "b/123", |
| 48 | Locations: []Location{ |
| 49 | {Comment: "internal bug"}, |
| 50 | }, |
| 51 | }, |
| 52 | }, |
| 53 | { |
| 54 | line: "TODO(issue): not todo", |
| 55 | }, |
| 56 | { |
| 57 | line: "FIXME(issue): not todo", |
| 58 | }, |
| 59 | { |
| 60 | line: "// TODO (issue): not todo", |
| 61 | }, |
| 62 | { |
| 63 | line: "// TODO(issue) not todo", |
| 64 | }, |
| 65 | { |
| 66 | line: "// todo(issue): not todo", |
| 67 | }, |
| 68 | { |
| 69 | line: "// TODO(issue):", |
| 70 | }, |
| 71 | } { |
| 72 | t.Logf("Testing: %s", tc.line) |
| 73 | r := Reviver{} |
| 74 | got := r.processLine(tc.line, "test", 0) |
| 75 | if got == nil { |
| 76 | if tc.want != nil { |
| 77 | t.Errorf("failed to process line, want: %+v", tc.want) |
| 78 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…