From: Jason A. Donenfeld Date: Mon, 10 May 2021 20:23:32 +0000 (+0200) Subject: main: replace crlf on windows in fmt test X-Git-Tag: 0.0.20211016~31 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9844c74f67ecb5dcca92646dd2c23fcfa21c0703;p=thirdparty%2Fwireguard-go.git main: replace crlf on windows in fmt test Signed-off-by: Jason A. Donenfeld --- 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)