(t *testing.T)
| 66 | } |
| 67 | |
| 68 | func TestFormatBody(t *testing.T) { |
| 69 | testCases := []struct { |
| 70 | input string |
| 71 | expectedBody string |
| 72 | expectedExcerpt bool |
| 73 | }{ |
| 74 | { |
| 75 | input: "single line", |
| 76 | expectedBody: "single line", |
| 77 | expectedExcerpt: false, |
| 78 | }, |
| 79 | { |
| 80 | input: "first line\nsecond line", |
| 81 | expectedBody: "first line", |
| 82 | expectedExcerpt: true, |
| 83 | }, |
| 84 | { |
| 85 | input: "first line\r\nsecond line", |
| 86 | expectedBody: "first line", |
| 87 | expectedExcerpt: true, |
| 88 | }, |
| 89 | { |
| 90 | input: " spaced line ", |
| 91 | expectedBody: "spaced line", |
| 92 | expectedExcerpt: false, |
| 93 | }, |
| 94 | { |
| 95 | input: " first line \nsecond line", |
| 96 | expectedBody: "first line", |
| 97 | expectedExcerpt: true, |
| 98 | }, |
| 99 | { |
| 100 | input: "", |
| 101 | expectedBody: "", |
| 102 | expectedExcerpt: false, |
| 103 | }, |
| 104 | { |
| 105 | input: "line with trailing newline\n", |
| 106 | expectedBody: "line with trailing newline", |
| 107 | expectedExcerpt: false, |
| 108 | }, |
| 109 | { |
| 110 | input: "line with trailing newlines\n\n", |
| 111 | expectedBody: "line with trailing newlines", |
| 112 | expectedExcerpt: false, |
| 113 | }, |
| 114 | } |
| 115 | |
| 116 | for _, tc := range testCases { |
| 117 | t.Run(fmt.Sprintf("input: %q", tc.input), func(t *testing.T) { |
| 118 | gotBody, gotExcerpt := formatBody(tc.input) |
| 119 | assert.Equal(t, gotBody, tc.expectedBody, "formatted body mismatch") |
| 120 | assert.Equal(t, gotExcerpt, tc.expectedExcerpt, "excerpt flag mismatch") |
| 121 | }) |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | func TestListNotes(t *testing.T) { |
nothing calls this directly
no test coverage detected