Translate line endings for test reference output (*nix -> windows), as git changes by default to windows

This commit is contained in:
Jason DeBettencourt
2021-02-27 18:57:14 -05:00
parent 6976024d57
commit 9132cd04c3

View File

@@ -565,6 +565,14 @@ func TestConcurrentProcesses(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
if runtime.GOOS == "windows" {
// reference tests are in *nix format --
// but git on windows does line-ending xlation by default
// if someone has it 'off' this has no impact.
// '\r\n' --> '\n'
b = bytes.ReplaceAll(b, []byte("\r\n"), []byte("\n"))
}
if err := ioutil.WriteFile(filepath.Join(dir, filepath.Base(v)), b, 0666); err != nil { if err := ioutil.WriteFile(filepath.Join(dir, filepath.Base(v)), b, 0666); err != nil {
t.Fatal(err) t.Fatal(err)
} }