(t *testing.T)
| 712 | } |
| 713 | |
| 714 | func TestIsSingleHunkForWholeFile(t *testing.T) { |
| 715 | scenarios := []struct { |
| 716 | testName string |
| 717 | patchStr string |
| 718 | expectedResult bool |
| 719 | }{ |
| 720 | { |
| 721 | testName: "simpleDiff", |
| 722 | patchStr: simpleDiff, |
| 723 | expectedResult: false, |
| 724 | }, |
| 725 | { |
| 726 | testName: "addNewlineToEndOfFile", |
| 727 | patchStr: addNewlineToEndOfFile, |
| 728 | expectedResult: false, |
| 729 | }, |
| 730 | { |
| 731 | testName: "removeNewlinefromEndOfFile", |
| 732 | patchStr: removeNewlinefromEndOfFile, |
| 733 | expectedResult: false, |
| 734 | }, |
| 735 | { |
| 736 | testName: "twoHunks", |
| 737 | patchStr: twoHunks, |
| 738 | expectedResult: false, |
| 739 | }, |
| 740 | { |
| 741 | testName: "twoChangesInOneHunk", |
| 742 | patchStr: twoChangesInOneHunk, |
| 743 | expectedResult: false, |
| 744 | }, |
| 745 | { |
| 746 | testName: "newFile", |
| 747 | patchStr: newFile, |
| 748 | expectedResult: true, |
| 749 | }, |
| 750 | { |
| 751 | testName: "deletedFile", |
| 752 | patchStr: deletedFile, |
| 753 | expectedResult: true, |
| 754 | }, |
| 755 | { |
| 756 | testName: "addNewlineToPreviouslyEmptyFile", |
| 757 | patchStr: addNewlineToPreviouslyEmptyFile, |
| 758 | expectedResult: true, |
| 759 | }, |
| 760 | { |
| 761 | testName: "exampleHunk", |
| 762 | patchStr: exampleHunk, |
| 763 | expectedResult: false, |
| 764 | }, |
| 765 | } |
| 766 | |
| 767 | for _, s := range scenarios { |
| 768 | t.Run(s.testName, func(t *testing.T) { |
| 769 | patch := Parse(s.patchStr) |
| 770 | assert.Equal(t, s.expectedResult, patch.IsSingleHunkForWholeFile()) |
| 771 | }) |
nothing calls this directly
no test coverage detected