aboutsummaryrefslogtreecommitdiff
path: root/shared_test.go
diff options
context:
space:
mode:
authorStefan Majewsky <majewsky@gmx.net>2018-02-19 17:58:08 +0100
committerStefan Majewsky <majewsky@gmx.net>2018-02-19 17:58:08 +0100
commitd1dec3782fb5f9aa5775dafb0ea1225af6279ed2 (patch)
tree8f06c0fbcc3c93b18ce0c90cb2e4b0f3b8d08f29 /shared_test.go
parent502acc3c73e789e856a17b878889db4356fe898c (diff)
downloadgo-schwift-d1dec3782fb5f9aa5775dafb0ea1225af6279ed2.tar.gz
replace expectError by expectSuccess where possible
Diffstat (limited to 'shared_test.go')
-rw-r--r--shared_test.go29
1 files changed, 13 insertions, 16 deletions
diff --git a/shared_test.go b/shared_test.go
index 10402bc..be29557 100644
--- a/shared_test.go
+++ b/shared_test.go
@@ -177,20 +177,21 @@ func expectString(t *testing.T, actual string, expected string) {
func expectError(t *testing.T, actual error, expected string) (ok bool) {
t.Helper()
if actual == nil {
- if expected != "" {
- t.Errorf("expected error %q, got no error\n", expected)
- return false
- }
- } else {
- if expected == "" {
- t.Errorf("expected no error, got %q\n", actual.Error())
- return false
- } else if expected != actual.Error() {
- t.Errorf("expected error %q, got %q instead\n", expected, actual.Error())
- return false
- }
+ t.Errorf("expected error %q, got no error\n", expected)
+ return false
}
+ if expected != actual.Error() {
+ t.Errorf("expected error %q, got %q instead\n", expected, actual.Error())
+ return false
+ }
+ return true
+}
+func expectSuccess(t *testing.T, actual error) (ok bool) {
+ if actual != nil {
+ t.Errorf("expected success, got error %q instead\n", actual.Error())
+ return false
+ }
return true
}
@@ -219,7 +220,3 @@ func expectHeaders(t *testing.T, actual map[string]string, expected map[string]s
}
}
}
-
-func expectSuccess(t *testing.T, actual error) (ok bool) {
- return expectError(t, actual, "")
-}