From 48a6bbf043fea22630cac3b737e38e25d253e680 Mon Sep 17 00:00:00 2001 From: vilmibm Date: Mon, 2 Mar 2020 14:38:49 -0600 Subject: [PATCH] minor golfing --- command/repo_test.go | 48 +++++++++++++++----------------------------- 1 file changed, 16 insertions(+), 32 deletions(-) diff --git a/command/repo_test.go b/command/repo_test.go index bf94057d2..eccbfa4fb 100644 --- a/command/repo_test.go +++ b/command/repo_test.go @@ -61,14 +61,10 @@ func TestRepoFork_in_parent(t *testing.T) { eq(t, output.Stderr(), "") - expectedLines := []*regexp.Regexp{ - regexp.MustCompile(`Created fork someone/REPO`), - } - for _, r := range expectedLines { - if !r.MatchString(output.String()) { - t.Errorf("output did not match regexp /%s/\n> output\n%s\n", r, output) - return - } + r := regexp.MustCompile(`Created fork someone/REPO`) + if !r.MatchString(output.String()) { + t.Errorf("output did not match regexp /%s/\n> output\n%s\n", r, output) + return } } @@ -99,14 +95,10 @@ func TestRepoFork_outside(t *testing.T) { eq(t, output.Stderr(), "") - expectedLines := []*regexp.Regexp{ - regexp.MustCompile(`Created fork someone/REPO`), - } - for _, r := range expectedLines { - if !r.MatchString(output.String()) { - t.Errorf("output did not match regexp /%s/\n> output\n%s\n", r, output) - return - } + r := regexp.MustCompile(`Created fork someone/REPO`) + if !r.MatchString(output.String()) { + t.Errorf("output did not match regexp /%s/\n> output\n%s\n", r, output) + return } }) } @@ -251,14 +243,10 @@ func TestRepoFork_outside_survey_no(t *testing.T) { eq(t, cmdRun, false) - expectedLines := []*regexp.Regexp{ - regexp.MustCompile(`Created fork someone/REPO`), - } - for _, r := range expectedLines { - if !r.MatchString(output.String()) { - t.Errorf("output did not match regexp /%s/\n> output\n%s\n", r, output) - return - } + r := regexp.MustCompile(`Created fork someone/REPO`) + if !r.MatchString(output.String()) { + t.Errorf("output did not match regexp /%s/\n> output\n%s\n", r, output) + return } } @@ -339,14 +327,10 @@ func TestRepoFork_in_parent_survey_no(t *testing.T) { eq(t, cmdRun, false) - expectedLines := []*regexp.Regexp{ - regexp.MustCompile(`Created fork someone/REPO`), - } - for _, r := range expectedLines { - if !r.MatchString(output.String()) { - t.Errorf("output did not match regexp /%s/\n> output\n%s\n", r, output) - return - } + r := regexp.MustCompile(`Created fork someone/REPO`) + if !r.MatchString(output.String()) { + t.Errorf("output did not match regexp /%s/\n> output\n%s\n", r, output) + return } }