Fix tests on windows.

This commit is contained in:
go-jet 2019-07-18 11:41:33 +02:00
parent c97c6d1da4
commit d253a35161

View file

@ -1,6 +1,7 @@
package tests
import (
"bytes"
"context"
"encoding/json"
"fmt"
@ -9,6 +10,7 @@ import (
. "github.com/go-jet/jet/tests/.gentestdata/jetdb/chinook/table"
"gotest.tools/assert"
"io/ioutil"
"runtime"
"testing"
"time"
)
@ -346,6 +348,10 @@ func assertJsonFile(t *testing.T, jsonFilePath string, data interface{}) {
fileJsonData, err := ioutil.ReadFile(jsonFilePath)
assert.NilError(t, err)
if runtime.GOOS == "windows" {
fileJsonData = bytes.Replace(fileJsonData, []byte("\r\n"), []byte("\n"), -1)
}
jsonData, err := json.MarshalIndent(data, "", "\t")
assert.NilError(t, err)