Skip to content

Commit

Permalink
Fix unit-test failing for Windows platform
Browse files Browse the repository at this point in the history
  • Loading branch information
gaby committed Dec 18, 2023
1 parent ef10fcd commit edfce46
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"io/fs"
"net/http"
"os"
"runtime"
"testing"

"github.com/stretchr/testify/require"
Expand All @@ -15,7 +16,13 @@ func Test_ReadFile(t *testing.T) {
testFS := http.FS(os.DirFS(".github/tests"))
file, err := ReadFile("john.txt", testFS)

require.Equal(t, string(file), "doe\n")
switch runtime.GOOS {
case "windows":
require.Equal(t, string(file), "doe\r\n")
default:
require.Equal(t, string(file), "doe\n")
}

require.NoError(t, err)
}

Expand Down

0 comments on commit edfce46

Please sign in to comment.