--- extractHunkContext ---
(t *testing.T)
| 195 | // --- extractHunkContext --- |
| 196 | |
| 197 | func TestExtractHunkContext(t *testing.T) { |
| 198 | t.Parallel() |
| 199 | tests := []struct { |
| 200 | name string |
| 201 | input string |
| 202 | want string |
| 203 | }{ |
| 204 | {"with_func", "@@ -13,6 +13,7 @@ func main() {", "func main() {"}, |
| 205 | {"no_context", "@@ -13,6 +13,7 @@", "-13,6 +13,7"}, |
| 206 | {"empty_context", "@@ -1,3 +1,4 @@ ", "-1,3 +1,4"}, |
| 207 | {"complex", "@@ -100,20 +105,25 @@ type Foo struct {", "type Foo struct {"}, |
| 208 | {"bare", "@@@@", ""}, |
| 209 | } |
| 210 | for _, tt := range tests { |
| 211 | t.Run(tt.name, func(t *testing.T) { |
| 212 | t.Parallel() |
| 213 | got := extractHunkContext(tt.input) |
| 214 | if got != tt.want { |
| 215 | t.Errorf("extractHunkContext(%q) = %q, want %q", tt.input, got, tt.want) |
| 216 | } |
| 217 | }) |
| 218 | } |
| 219 | } |
| 220 | |
| 221 | // --- parseHunkHeader --- |
| 222 |
nothing calls this directly
no test coverage detected