diff --git a/integration-cli/docker_cli_rmi_test.go b/integration-cli/docker_cli_rmi_test.go index 4600c481fd..63d9f92983 100644 --- a/integration-cli/docker_cli_rmi_test.go +++ b/integration-cli/docker_cli_rmi_test.go @@ -46,14 +46,14 @@ func TestRmiTag(t *testing.T) { dockerCmd(t, "tag", "busybox", "utest:5000/docker:tag3") { imagesAfter, _, _ := dockerCmd(t, "images", "-a") - if nLines(imagesAfter) != nLines(imagesBefore)+3 { + if strings.Count(imagesAfter, "\n") != strings.Count(imagesBefore, "\n")+3 { t.Fatalf("before: %q\n\nafter: %q\n", imagesBefore, imagesAfter) } } dockerCmd(t, "rmi", "utest/docker:tag2") { imagesAfter, _, _ := dockerCmd(t, "images", "-a") - if nLines(imagesAfter) != nLines(imagesBefore)+2 { + if strings.Count(imagesAfter, "\n") != strings.Count(imagesBefore, "\n")+2 { t.Fatalf("before: %q\n\nafter: %q\n", imagesBefore, imagesAfter) } @@ -61,7 +61,7 @@ func TestRmiTag(t *testing.T) { dockerCmd(t, "rmi", "utest:5000/docker:tag3") { imagesAfter, _, _ := dockerCmd(t, "images", "-a") - if nLines(imagesAfter) != nLines(imagesBefore)+1 { + if strings.Count(imagesAfter, "\n") != strings.Count(imagesBefore, "\n")+1 { t.Fatalf("before: %q\n\nafter: %q\n", imagesBefore, imagesAfter) } @@ -69,7 +69,7 @@ func TestRmiTag(t *testing.T) { dockerCmd(t, "rmi", "utest:tag1") { imagesAfter, _, _ := dockerCmd(t, "images", "-a") - if nLines(imagesAfter) != nLines(imagesBefore)+0 { + if strings.Count(imagesAfter, "\n") != strings.Count(imagesBefore, "\n")+0 { t.Fatalf("before: %q\n\nafter: %q\n", imagesBefore, imagesAfter) } diff --git a/integration-cli/utils.go b/integration-cli/utils.go index 37ce221b9b..3ff6d3c438 100644 --- a/integration-cli/utils.go +++ b/integration-cli/utils.go @@ -105,10 +105,6 @@ func stripTrailingCharacters(target string) string { return target } -func nLines(s string) int { - return strings.Count(s, "\n") -} - func unmarshalJSON(data []byte, result interface{}) error { err := json.Unmarshal(data, result) if err != nil {