Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Commit

Permalink
fix(tests): lower cyclomatic complexity of Checklist
Browse files Browse the repository at this point in the history
It was a little confusing to read the different cases, so I lowered
the complexity in order to read through the code for future readers.
  • Loading branch information
Matthew Fisher committed Mar 20, 2015
1 parent 6328afe commit ea765c8
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions tests/utils/itutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,10 @@ func CheckList(
if err != nil {
t.Fatal(err)
}
if strings.Contains(stdout.String(), contain) == notflag {
if notflag {
t.Fatalf(
"Didn't expect '%s' in command output:\n%v", contain, stdout)
}
if notflag && strings.Contains(stdout.String(), contain) {
t.Fatalf("Didn't expect '%s' in command output:\n%v", contain, stdout)
}
if !notflag && !strings.Contains(stdout.String(), contain) {
t.Fatalf("Expected '%s' in command output:\n%v", contain, stdout)
}
}
Expand Down

0 comments on commit ea765c8

Please sign in to comment.