]> git.ipfire.org Git - thirdparty/wireguard-go.git/commitdiff
main: replace crlf on windows in fmt test
authorJason A. Donenfeld <Jason@zx2c4.com>
Mon, 10 May 2021 20:23:32 +0000 (22:23 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Mon, 10 May 2021 20:23:32 +0000 (22:23 +0200)
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
format_test.go

index 60e212d3fd9d81e8ee8c93056799b8ded5f411b1..198cd49ced7ddaa71be628a7ee40cc4dfb7a3546 100644 (file)
@@ -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)