Merge pull request #17616 from Microsoft/10662-fix-dockerfile-parser

Windows: Fix dockerfile\parser TestTestData unit test
This commit is contained in:
Vincent Demeester 2015-11-07 09:12:43 +01:00
commit 98a1141db9
1 changed files with 7 additions and 0 deletions

View File

@ -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))