aboutsummaryrefslogtreecommitdiffhomepage
path: root/tpl/inflect
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2019-08-10 21:05:17 +0200
committerBjørn Erik Pedersen <[email protected]>2019-08-12 13:26:32 +0200
commit9e571827055dedb46b78c5db3d17d6913f14870b (patch)
treef5f0108afe0c9385ff6dc27664943d9f719f57ad /tpl/inflect
parent6027ee11082d0b9d72de1d4d1980a702be294ad2 (diff)
downloadhugo-9e571827055dedb46b78c5db3d17d6913f14870b.tar.gz
hugo-9e571827055dedb46b78c5db3d17d6913f14870b.zip
tests: Convert from testify to quicktest
Diffstat (limited to 'tpl/inflect')
-rw-r--r--tpl/inflect/inflect_test.go14
-rw-r--r--tpl/inflect/init_test.go9
2 files changed, 12 insertions, 11 deletions
diff --git a/tpl/inflect/inflect_test.go b/tpl/inflect/inflect_test.go
index a94a20218..609d4a470 100644
--- a/tpl/inflect/inflect_test.go
+++ b/tpl/inflect/inflect_test.go
@@ -1,19 +1,18 @@
package inflect
import (
- "fmt"
"testing"
- "github.com/stretchr/testify/assert"
- "github.com/stretchr/testify/require"
+ qt "github.com/frankban/quicktest"
)
func TestInflect(t *testing.T) {
t.Parallel()
+ c := qt.New(t)
ns := New()
- for i, test := range []struct {
+ for _, test := range []struct {
fn func(i interface{}) (string, error)
in interface{}
expect interface{}
@@ -34,16 +33,15 @@ func TestInflect(t *testing.T) {
{ns.Singularize, "", ""},
{ns.Singularize, t, false},
} {
- errMsg := fmt.Sprintf("[%d] %v", i, test)
result, err := test.fn(test.in)
if b, ok := test.expect.(bool); ok && !b {
- require.Error(t, err, errMsg)
+ c.Assert(err, qt.Not(qt.IsNil))
continue
}
- require.NoError(t, err, errMsg)
- assert.Equal(t, test.expect, result, errMsg)
+ c.Assert(err, qt.IsNil)
+ c.Assert(result, qt.Equals, test.expect)
}
}
diff --git a/tpl/inflect/init_test.go b/tpl/inflect/init_test.go
index cbcd312c7..322813b5f 100644
--- a/tpl/inflect/init_test.go
+++ b/tpl/inflect/init_test.go
@@ -16,12 +16,15 @@ package inflect
import (
"testing"
+ "github.com/gohugoio/hugo/htesting/hqt"
+
+ qt "github.com/frankban/quicktest"
"github.com/gohugoio/hugo/deps"
"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 +36,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{})
}