Browse code

Windows: Fix dockerfile\parser unit test

Signed-off-by: John Howard <jhoward@microsoft.com>

John Howard authored on 2015/11/02 13:08:37
Showing 1 changed files
... ...
@@ -1,10 +1,12 @@
1 1
 package parser
2 2
 
3 3
 import (
4
+	"bytes"
4 5
 	"fmt"
5 6
 	"io/ioutil"
6 7
 	"os"
7 8
 	"path/filepath"
9
+	"runtime"
8 10
 	"testing"
9 11
 )
10 12
 
... ...
@@ -66,6 +68,11 @@ func TestTestData(t *testing.T) {
66 66
 			t.Fatalf("Error reading %s's result file: %v", dir, err)
67 67
 		}
68 68
 
69
+		if runtime.GOOS == "windows" {
70
+			// CRLF --> CR to match Unix behaviour
71
+			content = bytes.Replace(content, []byte{'\x0d', '\x0a'}, []byte{'\x0a'}, -1)
72
+		}
73
+
69 74
 		if ast.Dump()+"\n" != string(content) {
70 75
 			fmt.Fprintln(os.Stderr, "Result:\n"+ast.Dump())
71 76
 			fmt.Fprintln(os.Stderr, "Expected:\n"+string(content))