Skip to content

Commit 48a6bbf

Browse files
committed
minor golfing
1 parent 6a57f04 commit 48a6bbf

File tree

1 file changed

+16
-32
lines changed

1 file changed

+16
-32
lines changed

command/repo_test.go

Lines changed: 16 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,10 @@ func TestRepoFork_in_parent(t *testing.T) {
6161

6262
eq(t, output.Stderr(), "")
6363

64-
expectedLines := []*regexp.Regexp{
65-
regexp.MustCompile(`Created fork someone/REPO`),
66-
}
67-
for _, r := range expectedLines {
68-
if !r.MatchString(output.String()) {
69-
t.Errorf("output did not match regexp /%s/\n> output\n%s\n", r, output)
70-
return
71-
}
64+
r := regexp.MustCompile(`Created fork someone/REPO`)
65+
if !r.MatchString(output.String()) {
66+
t.Errorf("output did not match regexp /%s/\n> output\n%s\n", r, output)
67+
return
7268
}
7369
}
7470

@@ -99,14 +95,10 @@ func TestRepoFork_outside(t *testing.T) {
9995

10096
eq(t, output.Stderr(), "")
10197

102-
expectedLines := []*regexp.Regexp{
103-
regexp.MustCompile(`Created fork someone/REPO`),
104-
}
105-
for _, r := range expectedLines {
106-
if !r.MatchString(output.String()) {
107-
t.Errorf("output did not match regexp /%s/\n> output\n%s\n", r, output)
108-
return
109-
}
98+
r := regexp.MustCompile(`Created fork someone/REPO`)
99+
if !r.MatchString(output.String()) {
100+
t.Errorf("output did not match regexp /%s/\n> output\n%s\n", r, output)
101+
return
110102
}
111103
})
112104
}
@@ -251,14 +243,10 @@ func TestRepoFork_outside_survey_no(t *testing.T) {
251243

252244
eq(t, cmdRun, false)
253245

254-
expectedLines := []*regexp.Regexp{
255-
regexp.MustCompile(`Created fork someone/REPO`),
256-
}
257-
for _, r := range expectedLines {
258-
if !r.MatchString(output.String()) {
259-
t.Errorf("output did not match regexp /%s/\n> output\n%s\n", r, output)
260-
return
261-
}
246+
r := regexp.MustCompile(`Created fork someone/REPO`)
247+
if !r.MatchString(output.String()) {
248+
t.Errorf("output did not match regexp /%s/\n> output\n%s\n", r, output)
249+
return
262250
}
263251
}
264252

@@ -339,14 +327,10 @@ func TestRepoFork_in_parent_survey_no(t *testing.T) {
339327

340328
eq(t, cmdRun, false)
341329

342-
expectedLines := []*regexp.Regexp{
343-
regexp.MustCompile(`Created fork someone/REPO`),
344-
}
345-
for _, r := range expectedLines {
346-
if !r.MatchString(output.String()) {
347-
t.Errorf("output did not match regexp /%s/\n> output\n%s\n", r, output)
348-
return
349-
}
330+
r := regexp.MustCompile(`Created fork someone/REPO`)
331+
if !r.MatchString(output.String()) {
332+
t.Errorf("output did not match regexp /%s/\n> output\n%s\n", r, output)
333+
return
350334
}
351335
}
352336

0 commit comments

Comments
 (0)