Merge pull request #9610 from duglin/Issue9602

Wrap strings that could look like ints in quotes
This commit is contained in:
Michael Crosby
2014-12-16 12:02:26 -08:00
8 changed files with 45 additions and 23 deletions
+24 -2
View File
@@ -3004,13 +3004,35 @@ docker.com>"
t.Fatal(err)
}
if res != "Docker IO <io@docker.com>" {
t.Fatal("Parsed string did not match the escaped string")
if res != "\"Docker IO <io@docker.com>\"" {
t.Fatalf("Parsed string did not match the escaped string. Got: %q", res)
}
logDone("build - validate escaping whitespace")
}
func TestBuildVerifyIntString(t *testing.T) {
// Verify that strings that look like ints are still passed as strings
name := "testbuildstringing"
defer deleteImages(name)
_, err := buildImage(name, `
FROM busybox
MAINTAINER 123
`, true)
out, rc, err := runCommandWithOutput(exec.Command(dockerBinary, "inspect", name))
if rc != 0 || err != nil {
t.Fatalf("Unexcepted error from inspect: rc: %v err: %v", rc, err)
}
if !strings.Contains(out, "\"123\"") {
t.Fatalf("Output does not contain the int as a string:\n%s", out)
}
logDone("build - verify int/strings as strings")
}
func TestBuildDockerignore(t *testing.T) {
name := "testbuilddockerignore"
defer deleteImages(name)