From 864e892e2a310c5b67dfd842e39634dd0d99da73 Mon Sep 17 00:00:00 2001 From: John Howard Date: Sun, 1 Nov 2015 20:08:37 -0800 Subject: [PATCH] Windows: Fix dockerfile\parser unit test Signed-off-by: John Howard --- builder/dockerfile/parser/parser_test.go | 7 +++++++ 1 file changed, 7 insertions(+) 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))