1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-15 00:15:32 +02:00

Fix ForEachLineInFile to not lose the last line if it doesn't end with a LF

This commit is contained in:
Stefan Haller
2024-10-09 15:37:08 +02:00
parent b71aa5e23b
commit 696e78fcc8
3 changed files with 2 additions and 11 deletions

View File

@ -26,10 +26,7 @@ func Test_forEachLineInStream(t *testing.T) {
{
name: "single line without line feed",
input: "abc",
/* EXPECTED:
expectedLines: []string{"abc"},
ACTUAL: */
expectedLines: []string{},
},
{
name: "multiple lines",
@ -44,10 +41,7 @@ func Test_forEachLineInStream(t *testing.T) {
{
name: "multiple lines without linefeed at end of file",
input: "abc\ndef\nghi",
/* EXPECTED:
expectedLines: []string{"abc\n", "def\n", "ghi"},
ACTUAL: */
expectedLines: []string{"abc\n", "def\n"},
},
}