Browse code

Add a testcase to make sure we don't squash tabs or convert them to spaces

This is in response to @SvenDowideit asking if we had a "tab" testcase
in https://github.com/docker/docker/issues/2315#issuecomment-58133508
I couldn't find one so I'm adding one

Closes #2315

Signed-off-by: Doug Davis <dug@us.ibm.com>

Doug Davis authored on 2014/10/09 06:55:02
Showing 1 changed files
... ...
@@ -2907,3 +2907,22 @@ RUN echo 123`,
2907 2907
 
2908 2908
 	logDone("build - verbose output from commands")
2909 2909
 }
2910
+
2911
+func TestBuildWithTabs(t *testing.T) {
2912
+	name := "testbuildwithtabs"
2913
+	defer deleteImages(name)
2914
+	_, err := buildImage(name,
2915
+		"FROM busybox\nRUN echo\tone\t\ttwo", true)
2916
+	if err != nil {
2917
+		t.Fatal(err)
2918
+	}
2919
+	res, err := inspectFieldJSON(name, "ContainerConfig.Cmd")
2920
+	if err != nil {
2921
+		t.Fatal(err)
2922
+	}
2923
+	expected := "[\"/bin/sh\",\"-c\",\"echo\\u0009one\\u0009\\u0009two\"]"
2924
+	if res != expected {
2925
+		t.Fatalf("Missing tabs.\nGot:%s\nExp:%s", res, expected)
2926
+	}
2927
+	logDone("build - with tabs")
2928
+}