Bundle the reverse and keepOriginalHeader flags into a PatchOptions struct

We are going to add one more flag in the next commit.

Note that we are not using the struct inside patch_manager.go; we keep passing
the individual flags there. The reason for this will become more obvious later
in this branch.
This commit is contained in:
Stefan Haller 2023-02-26 13:20:10 +01:00
parent 5a50bfd179
commit f76cc27956
4 changed files with 29 additions and 14 deletions

View file

@ -513,7 +513,8 @@ func TestModifyPatchForRange(t *testing.T) {
for _, s := range scenarios {
s := s
t.Run(s.testName, func(t *testing.T) {
result := ModifiedPatchForRange(nil, s.filename, s.diffText, s.firstLineIndex, s.lastLineIndex, s.reverse, false)
result := ModifiedPatchForRange(nil, s.filename, s.diffText, s.firstLineIndex, s.lastLineIndex,
PatchOptions{Reverse: s.reverse, KeepOriginalHeader: false})
if !assert.Equal(t, s.expected, result) {
fmt.Println(result)
}