mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-17 21:01:26 +02:00
tpl: Avoid repeating the same test case in TestMD5 and TesSHA*
This commit is contained in:
@@ -2535,13 +2535,13 @@ 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")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
func TestSHA1(t *testing.T) {
|
func TestSHA1(t *testing.T) {
|
||||||
for i, this := range []struct {
|
for i, this := range []struct {
|
||||||
@@ -2559,13 +2559,13 @@ 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")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
func TestSHA256(t *testing.T) {
|
func TestSHA256(t *testing.T) {
|
||||||
for i, this := range []struct {
|
for i, this := range []struct {
|
||||||
@@ -2583,13 +2583,13 @@ 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")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
func TestReadFile(t *testing.T) {
|
func TestReadFile(t *testing.T) {
|
||||||
viper.Reset()
|
viper.Reset()
|
||||||
|
Reference in New Issue
Block a user