Fix tests on windows.
This commit is contained in:
parent
c97c6d1da4
commit
d253a35161
1 changed files with 6 additions and 0 deletions
|
|
@ -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)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue