Clarify comment on CRLF normalization in tests

Updated comments in log_test.go to clarify that CRLF is normalized to LF for OS-agnostic test behavior, improving code readability.
This commit is contained in:
Kynan Ware 2025-09-16 11:47:48 -06:00
parent 37d8e0a438
commit d636f4c213

View file

@ -34,7 +34,7 @@ func TestFollow(t *testing.T) {
raw, err := os.ReadFile(tt.log)
require.NoError(t, err)
// Delete all the `/r` to make the tests OS-agnostic.
// Normalize CRLF to LF to make the tests OS-agnostic.
raw = []byte(strings.ReplaceAll(string(raw), "\r\n", "\n"))
lines := slices.DeleteFunc(strings.Split(string(raw), "\n"), func(line string) bool {
@ -63,7 +63,7 @@ func TestFollow(t *testing.T) {
want, err := os.ReadFile(tt.want)
require.NoError(t, err)
// Delete all the `/r` to make the tests OS-agnostic.
// Normalize CRLF to LF to make the tests OS-agnostic.
want = []byte(strings.ReplaceAll(string(want), "\r\n", "\n"))
assert.Equal(t, string(want), stdout.String())