зеркало из https://github.com/microsoft/docker.git
Merge pull request #6666 from erikh/fix-escaping-whitespace
fix whitespace that precedes the escape in a multiline string.
This commit is contained in:
Коммит
b85f20cf13
|
@ -1490,3 +1490,27 @@ func TestBuildAddToSymlinkDest(t *testing.T) {
|
||||||
}
|
}
|
||||||
logDone("build - add to symlink destination")
|
logDone("build - add to symlink destination")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestBuildEscapeWhitespace(t *testing.T) {
|
||||||
|
name := "testbuildescaping"
|
||||||
|
defer deleteImages(name)
|
||||||
|
|
||||||
|
_, err := buildImage(name, `
|
||||||
|
FROM busybox
|
||||||
|
MAINTAINER "Docker \
|
||||||
|
IO <io@\
|
||||||
|
docker.com>"
|
||||||
|
`, true)
|
||||||
|
|
||||||
|
res, err := inspectField(name, "Author")
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if res != "Docker IO <io@docker.com>" {
|
||||||
|
t.Fatal("Parsed string did not match the escaped string")
|
||||||
|
}
|
||||||
|
|
||||||
|
logDone("build - validate escaping whitespace")
|
||||||
|
}
|
||||||
|
|
|
@ -761,7 +761,7 @@ func (b *buildFile) commit(id string, autoCmd []string, comment string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Long lines can be split with a backslash
|
// Long lines can be split with a backslash
|
||||||
var lineContinuation = regexp.MustCompile(`\s*\\\s*\n`)
|
var lineContinuation = regexp.MustCompile(`\\\s*\n`)
|
||||||
|
|
||||||
func (b *buildFile) Build(context io.Reader) (string, error) {
|
func (b *buildFile) Build(context io.Reader) (string, error) {
|
||||||
tmpdirPath, err := ioutil.TempDir("", "docker-build")
|
tmpdirPath, err := ioutil.TempDir("", "docker-build")
|
||||||
|
|
Загрузка…
Ссылка в новой задаче