Remove unnecessary abstraction nLines

Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
This commit is contained in:
Jessica Frazelle 2014-12-03 17:47:28 -08:00
parent 7ba9a18ade
commit 02a021119f
2 changed files with 4 additions and 8 deletions

View file

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

View file

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