Skip to content

Commit 864e892

Browse files
author
John Howard
committed
Windows: Fix dockerfile\parser unit test
Signed-off-by: John Howard <jhoward@microsoft.com>
1 parent e2e2ea4 commit 864e892

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

builder/dockerfile/parser/parser_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
package parser
22

33
import (
4+
"bytes"
45
"fmt"
56
"io/ioutil"
67
"os"
78
"path/filepath"
9+
"runtime"
810
"testing"
911
)
1012

@@ -66,6 +68,11 @@ func TestTestData(t *testing.T) {
6668
t.Fatalf("Error reading %s's result file: %v", dir, err)
6769
}
6870

71+
if runtime.GOOS == "windows" {
72+
// CRLF --> CR to match Unix behaviour
73+
content = bytes.Replace(content, []byte{'\x0d', '\x0a'}, []byte{'\x0a'}, -1)
74+
}
75+
6976
if ast.Dump()+"\n" != string(content) {
7077
fmt.Fprintln(os.Stderr, "Result:\n"+ast.Dump())
7178
fmt.Fprintln(os.Stderr, "Expected:\n"+string(content))

0 commit comments

Comments
 (0)