Windows: Fix dockerfile\parser unit test

Signed-off-by: John Howard <jhoward@microsoft.com>
This commit is contained in:
John Howard 2015-11-01 20:08:37 -08:00
parent e2e2ea401a
commit 864e892e2a
1 changed files with 7 additions and 0 deletions

View File

@ -1,10 +1,12 @@
package parser package parser
import ( import (
"bytes"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
"runtime"
"testing" "testing"
) )
@ -66,6 +68,11 @@ func TestTestData(t *testing.T) {
t.Fatalf("Error reading %s's result file: %v", dir, err) 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) { if ast.Dump()+"\n" != string(content) {
fmt.Fprintln(os.Stderr, "Result:\n"+ast.Dump()) fmt.Fprintln(os.Stderr, "Result:\n"+ast.Dump())
fmt.Fprintln(os.Stderr, "Expected:\n"+string(content)) fmt.Fprintln(os.Stderr, "Expected:\n"+string(content))