From cd1099aac8cd2de0c3c47587a76da53df2c2f448 Mon Sep 17 00:00:00 2001 From: Steve Moyer Date: Mon, 6 Jun 2022 08:25:36 -0400 Subject: fix(808): replace Windows line terminators --- commands/root_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'commands') diff --git a/commands/root_test.go b/commands/root_test.go index 5e780ec7..5f5a8876 100644 --- a/commands/root_test.go +++ b/commands/root_test.go @@ -7,6 +7,7 @@ import ( "io/ioutil" "os" "path/filepath" + "strings" "testing" "github.com/MichaelMure/git-bug/commands" @@ -63,6 +64,9 @@ func (e *testEnv) Execute(t *testing.T) { func requireGoldenFileEqual(t *testing.T, path string, act []byte) { t.Helper() + // Replace Windows line terminators + act = []byte(strings.ReplaceAll(string(act), "\r\n", "\n")) + path = filepath.Join("testdata", path) if *update { @@ -71,7 +75,7 @@ func requireGoldenFileEqual(t *testing.T, path string, act []byte) { exp, err := ioutil.ReadFile(path) require.NoError(t, err) - require.Equal(t, exp, act) + require.Equal(t, string(exp), string(act)) } func TestNewRootCommand(t *testing.T) { -- cgit