Skip to content

Commit

Permalink
improved test helper
Browse files Browse the repository at this point in the history
  • Loading branch information
Karrick S. McDermott committed Apr 14, 2016
1 parent ea31f46 commit a8cf91e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,16 @@ func checkErrorFatal(t *testing.T, actualError error, expectedError interface{})
if actualError == nil {
t.Fatalf("Actual: %#v; Expected: %#v", actualError, expectedError)
} else {
var expected error
var expected string
switch expectedError.(type) {
case string:
expected = fmt.Errorf(expectedError.(string))
expected = expectedError.(string)
case error:
expected = expectedError.(error)
expected = expectedError.(error).Error()
}
if !strings.Contains(actualError.Error(), expected.Error()) {
if !strings.Contains(actualError.Error(), expected) {
t.Fatalf("Actual: %#v; Expected to contain: %#v",
actualError.Error(), expected.Error())
actualError.Error(), expected)
}
}
}
Expand Down

0 comments on commit a8cf91e

Please sign in to comment.