(t *testing.T)
| 381 | } |
| 382 | |
| 383 | func TestParseGitHeaderData(t *testing.T) { |
| 384 | tests := map[string]struct { |
| 385 | InputFile *File |
| 386 | Line string |
| 387 | DefaultName string |
| 388 | |
| 389 | OutputFile *File |
| 390 | End bool |
| 391 | Err bool |
| 392 | }{ |
| 393 | "fragementEndsParsing": { |
| 394 | Line: "@@ -12,3 +12,2 @@\n", |
| 395 | End: true, |
| 396 | }, |
| 397 | "unknownEndsParsing": { |
| 398 | Line: "GIT binary file\n", |
| 399 | End: true, |
| 400 | }, |
| 401 | "oldFileName": { |
| 402 | Line: "--- a/dir/file.txt\n", |
| 403 | OutputFile: &File{ |
| 404 | OldName: "dir/file.txt", |
| 405 | }, |
| 406 | }, |
| 407 | "oldFileNameDevNull": { |
| 408 | InputFile: &File{ |
| 409 | IsNew: true, |
| 410 | }, |
| 411 | Line: "--- /dev/null\n", |
| 412 | OutputFile: &File{ |
| 413 | IsNew: true, |
| 414 | }, |
| 415 | }, |
| 416 | "oldFileNameInconsistent": { |
| 417 | InputFile: &File{ |
| 418 | OldName: "dir/foo.txt", |
| 419 | }, |
| 420 | Line: "--- a/dir/bar.txt\n", |
| 421 | Err: true, |
| 422 | }, |
| 423 | "oldFileNameExistingCreateMismatch": { |
| 424 | InputFile: &File{ |
| 425 | OldName: "dir/foo.txt", |
| 426 | IsNew: true, |
| 427 | }, |
| 428 | Line: "--- /dev/null\n", |
| 429 | Err: true, |
| 430 | }, |
| 431 | "oldFileNameParsedCreateMismatch": { |
| 432 | InputFile: &File{ |
| 433 | IsNew: true, |
| 434 | }, |
| 435 | Line: "--- a/dir/file.txt\n", |
| 436 | Err: true, |
| 437 | }, |
| 438 | "oldFileNameMissing": { |
| 439 | Line: "--- \n", |
| 440 | Err: true, |
nothing calls this directly
no test coverage detected