Improve staging panel integration tests

This commit is contained in:
Jesse Duffield 2023-02-24 21:42:27 +11:00
parent 752526c880
commit db011d8e34
18 changed files with 417 additions and 116 deletions

View file

@ -134,7 +134,8 @@ func coloredString(textStyle style.TextStyle, str string, selected bool, include
}
func parsePatch(patch string) ([]int, []int, []*PatchLine) {
lines := strings.Split(patch, "\n")
// ignore trailing newline.
lines := strings.Split(strings.TrimSuffix(patch, "\n"), "\n")
hunkStarts := []int{}
stageableLines := []int{}
pastFirstHunkHeader := false
@ -179,6 +180,7 @@ func parsePatch(patch string) ([]int, []int, []*PatchLine) {
}
patchLines[index] = &PatchLine{Kind: lineKind, Content: line}
}
return hunkStarts, stageableLines, patchLines
}