(t *testing.T)
| 271 | } |
| 272 | |
| 273 | func TestHunkSplittingWithContext(t *testing.T) { |
| 274 | repo := &Repository{} |
| 275 | |
| 276 | tests := []struct { |
| 277 | name string |
| 278 | hunk *Hunk |
| 279 | expectedSplits int |
| 280 | expectedSplit1 []string |
| 281 | expectedSplit2 []string |
| 282 | }{ |
| 283 | { |
| 284 | name: "basic split with context line - real test case", |
| 285 | hunk: &Hunk{ |
| 286 | Type: HunkTypeHunk, |
| 287 | OldLine: 19, |
| 288 | NewLine: 19, |
| 289 | Text: []string{ |
| 290 | "@@ -19,7 +19,9 @@", |
| 291 | " }", |
| 292 | " }", |
| 293 | " ", |
| 294 | "+// comment1", |
| 295 | " func TestParseHunkHeader(t *testing.T) {", |
| 296 | "+ //comment2", |
| 297 | " repo := &Repository{}", |
| 298 | " hunk := &Hunk{", |
| 299 | " Text: []string{\"@@ -1,5 +2,6 @@ function test\"},", |
| 300 | }, |
| 301 | Display: []string{ |
| 302 | "@@ -19,7 +19,9 @@", |
| 303 | " }", |
| 304 | " }", |
| 305 | " ", |
| 306 | "+// comment1", |
| 307 | " func TestParseHunkHeader(t *testing.T) {", |
| 308 | "+ //comment2", |
| 309 | " repo := &Repository{}", |
| 310 | " hunk := &Hunk{", |
| 311 | " Text: []string{\"@@ -1,5 +2,6 @@ function test\"},", |
| 312 | }, |
| 313 | }, |
| 314 | expectedSplits: 2, |
| 315 | expectedSplit1: []string{ |
| 316 | "@@ -19,4 +19,5 @@", |
| 317 | " }", |
| 318 | " }", |
| 319 | " ", |
| 320 | "+// comment1", |
| 321 | " func TestParseHunkHeader(t *testing.T) {", |
| 322 | }, |
| 323 | expectedSplit2: []string{ |
| 324 | "@@ -22,4 +23,5 @@", |
| 325 | " func TestParseHunkHeader(t *testing.T) {", |
| 326 | "+ //comment2", |
| 327 | " repo := &Repository{}", |
| 328 | " hunk := &Hunk{", |
| 329 | " Text: []string{\"@@ -1,5 +2,6 @@ function test\"},", |
| 330 | }, |
nothing calls this directly
no test coverage detected