diff --git a/builder/dockerfile/parser/parser_test.go b/builder/dockerfile/parser/parser_test.go index 9734676469..b0ee351056 100644 --- a/builder/dockerfile/parser/parser_test.go +++ b/builder/dockerfile/parser/parser_test.go @@ -1,10 +1,12 @@ package parser import ( + "bytes" "fmt" "io/ioutil" "os" "path/filepath" + "runtime" "testing" ) @@ -66,6 +68,11 @@ func TestTestData(t *testing.T) { t.Fatalf("Error reading %s's result file: %v", dir, err) } + if runtime.GOOS == "windows" { + // CRLF --> CR to match Unix behaviour + content = bytes.Replace(content, []byte{'\x0d', '\x0a'}, []byte{'\x0a'}, -1) + } + if ast.Dump()+"\n" != string(content) { fmt.Fprintln(os.Stderr, "Result:\n"+ast.Dump()) fmt.Fprintln(os.Stderr, "Expected:\n"+string(content))