summaryrefslogtreecommitdiffhomepage
path: root/format_test.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2021-05-10 22:23:32 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2021-05-10 22:23:32 +0200
commit9844c74f67ecb5dcca92646dd2c23fcfa21c0703 (patch)
tree24eeb8b7158768876d7ffc62d97f43857bf55c27 /format_test.go
parent4e9e5dad09bedc372b2cf389cc791d029420a1cf (diff)
main: replace crlf on windows in fmt test
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'format_test.go')
-rw-r--r--format_test.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/format_test.go b/format_test.go
index 60e212d..198cd49 100644
--- a/format_test.go
+++ b/format_test.go
@@ -10,6 +10,7 @@ import (
"io/fs"
"os"
"path/filepath"
+ "runtime"
"sync"
"testing"
)
@@ -32,6 +33,9 @@ func TestFormatting(t *testing.T) {
t.Errorf("unable to read %s: %v", path, err)
return
}
+ if runtime.GOOS == "windows" {
+ src = bytes.ReplaceAll(src, []byte{'\r', '\n'}, []byte{'\n'})
+ }
formatted, err := format.Source(src)
if err != nil {
t.Errorf("unable to format %s: %v", path, err)