tpl: Avoid repeating the same test case in TestMD5 and TesSHA*

This commit is contained in:
Bjørn Erik Pedersen 2016-12-05 00:27:49 +01:00
parent 2236056672
commit 5b1eee44c6

View file

@ -2535,11 +2535,11 @@ func TestMD5(t *testing.T) {
if result != this.expectedHash { if result != this.expectedHash {
t.Errorf("[%d] md5: expected '%s', got '%s'", i, this.expectedHash, result) t.Errorf("[%d] md5: expected '%s', got '%s'", i, this.expectedHash, result)
} }
}
_, err = md5(t) _, err := md5(t)
if err == nil { if err == nil {
t.Error("Expected error from md5") t.Error("Expected error from md5")
}
} }
} }
@ -2559,11 +2559,11 @@ func TestSHA1(t *testing.T) {
if result != this.expectedHash { if result != this.expectedHash {
t.Errorf("[%d] sha1: expected '%s', got '%s'", i, this.expectedHash, result) t.Errorf("[%d] sha1: expected '%s', got '%s'", i, this.expectedHash, result)
} }
}
_, err = sha1(t) _, err := sha1(t)
if err == nil { if err == nil {
t.Error("Expected error from sha1") t.Error("Expected error from sha1")
}
} }
} }
@ -2583,11 +2583,11 @@ func TestSHA256(t *testing.T) {
if result != this.expectedHash { if result != this.expectedHash {
t.Errorf("[%d] sha256: expected '%s', got '%s'", i, this.expectedHash, result) t.Errorf("[%d] sha256: expected '%s', got '%s'", i, this.expectedHash, result)
} }
}
_, err = sha256(t) _, err := sha256(t)
if err == nil { if err == nil {
t.Error("Expected error from sha256") t.Error("Expected error from sha256")
}
} }
} }