diff --git a/pkg/integration/tests/conflicts/resolve_without_trailing_lf.go b/pkg/integration/tests/conflicts/resolve_without_trailing_lf.go index c85c3ea48..2af1eac54 100644 --- a/pkg/integration/tests/conflicts/resolve_without_trailing_lf.go +++ b/pkg/integration/tests/conflicts/resolve_without_trailing_lf.go @@ -52,9 +52,6 @@ var ResolveWithoutTrailingLf = NewIntegrationTest(NewIntegrationTestArgs{ Contains("M file").IsSelected(), ) - /* EXPECTED: t.Views().Main().Content(Contains("-a1\n+a2\n").DoesNotContain("-no eol")) - ACTUAL: */ - t.Views().Main().Content(Contains("-a1\n+a2\n").Contains("-no eol")) }, }) diff --git a/pkg/utils/io.go b/pkg/utils/io.go index 98d026429..1d222746b 100644 --- a/pkg/utils/io.go +++ b/pkg/utils/io.go @@ -21,8 +21,8 @@ func ForEachLineInFile(path string, f func(string, int)) error { func forEachLineInStream(reader io.Reader, f func(string, int)) { bufferedReader := bufio.NewReader(reader) for i := 0; true; i++ { - line, err := bufferedReader.ReadString('\n') - if err != nil { + line, _ := bufferedReader.ReadString('\n') + if len(line) == 0 { break } f(line, i) diff --git a/pkg/utils/io_test.go b/pkg/utils/io_test.go index bf1d46ebe..b8dfa957c 100644 --- a/pkg/utils/io_test.go +++ b/pkg/utils/io_test.go @@ -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"}, }, }