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