Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2019-08-10 22:05:17 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2019-08-12 14:26:32 +0300
commit9e571827055dedb46b78c5db3d17d6913f14870b (patch)
treef5f0108afe0c9385ff6dc27664943d9f719f57ad /tpl/crypto
parent6027ee11082d0b9d72de1d4d1980a702be294ad2 (diff)
tests: Convert from testify to quicktest
Diffstat (limited to 'tpl/crypto')
-rw-r--r--tpl/crypto/crypto_test.go33
-rw-r--r--tpl/crypto/init_test.go8
2 files changed, 21 insertions, 20 deletions
diff --git a/tpl/crypto/crypto_test.go b/tpl/crypto/crypto_test.go
index 1bd919c31..209ef9f0a 100644
--- a/tpl/crypto/crypto_test.go
+++ b/tpl/crypto/crypto_test.go
@@ -14,15 +14,14 @@
package crypto
import (
- "fmt"
"testing"
- "github.com/stretchr/testify/assert"
- "github.com/stretchr/testify/require"
+ qt "github.com/frankban/quicktest"
)
func TestMD5(t *testing.T) {
t.Parallel()
+ c := qt.New(t)
ns := New()
@@ -34,23 +33,23 @@ func TestMD5(t *testing.T) {
{"Lorem ipsum dolor", "06ce65ac476fc656bea3fca5d02cfd81"},
{t, false},
} {
- errMsg := fmt.Sprintf("[%d] %v", i, test.in)
+ errMsg := qt.Commentf("[%d] %v", i, test.in)
result, err := ns.MD5(test.in)
if b, ok := test.expect.(bool); ok && !b {
- require.Error(t, err, errMsg)
+ c.Assert(err, qt.Not(qt.IsNil), errMsg)
continue
}
- require.NoError(t, err, errMsg)
- assert.Equal(t, test.expect, result, errMsg)
+ c.Assert(err, qt.IsNil, errMsg)
+ c.Assert(result, qt.Equals, test.expect, errMsg)
}
}
func TestSHA1(t *testing.T) {
t.Parallel()
-
+ c := qt.New(t)
ns := New()
for i, test := range []struct {
@@ -61,23 +60,23 @@ func TestSHA1(t *testing.T) {
{"Lorem ipsum dolor", "45f75b844be4d17b3394c6701768daf39419c99b"},
{t, false},
} {
- errMsg := fmt.Sprintf("[%d] %v", i, test.in)
+ errMsg := qt.Commentf("[%d] %v", i, test.in)
result, err := ns.SHA1(test.in)
if b, ok := test.expect.(bool); ok && !b {
- require.Error(t, err, errMsg)
+ c.Assert(err, qt.Not(qt.IsNil), errMsg)
continue
}
- require.NoError(t, err, errMsg)
- assert.Equal(t, test.expect, result, errMsg)
+ c.Assert(err, qt.IsNil, errMsg)
+ c.Assert(result, qt.Equals, test.expect, errMsg)
}
}
func TestSHA256(t *testing.T) {
t.Parallel()
-
+ c := qt.New(t)
ns := New()
for i, test := range []struct {
@@ -88,16 +87,16 @@ func TestSHA256(t *testing.T) {
{"Lorem ipsum dolor", "9b3e1beb7053e0f900a674dd1c99aca3355e1275e1b03d3cb1bc977f5154e196"},
{t, false},
} {
- errMsg := fmt.Sprintf("[%d] %v", i, test.in)
+ errMsg := qt.Commentf("[%d] %v", i, test.in)
result, err := ns.SHA256(test.in)
if b, ok := test.expect.(bool); ok && !b {
- require.Error(t, err, errMsg)
+ c.Assert(err, qt.Not(qt.IsNil), errMsg)
continue
}
- require.NoError(t, err, errMsg)
- assert.Equal(t, test.expect, result, errMsg)
+ c.Assert(err, qt.IsNil, errMsg)
+ c.Assert(result, qt.Equals, test.expect, errMsg)
}
}
diff --git a/tpl/crypto/init_test.go b/tpl/crypto/init_test.go
index 852a90a40..120e1e4e7 100644
--- a/tpl/crypto/init_test.go
+++ b/tpl/crypto/init_test.go
@@ -16,12 +16,14 @@ package crypto
import (
"testing"
+ qt "github.com/frankban/quicktest"
"github.com/gohugoio/hugo/deps"
+ "github.com/gohugoio/hugo/htesting/hqt"
"github.com/gohugoio/hugo/tpl/internal"
- "github.com/stretchr/testify/require"
)
func TestInit(t *testing.T) {
+ c := qt.New(t)
var found bool
var ns *internal.TemplateFuncsNamespace
@@ -33,6 +35,6 @@ func TestInit(t *testing.T) {
}
}
- require.True(t, found)
- require.IsType(t, &Namespace{}, ns.Context())
+ c.Assert(found, qt.Equals, true)
+ c.Assert(ns.Context(), hqt.IsSameType, &Namespace{})
}