diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2019-08-10 22:05:17 +0300 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2019-08-12 14:26:32 +0300 |
commit | 9e571827055dedb46b78c5db3d17d6913f14870b (patch) | |
tree | f5f0108afe0c9385ff6dc27664943d9f719f57ad /tpl/urls | |
parent | 6027ee11082d0b9d72de1d4d1980a702be294ad2 (diff) |
tests: Convert from testify to quicktest
Diffstat (limited to 'tpl/urls')
-rw-r--r-- | tpl/urls/init_test.go | 8 | ||||
-rw-r--r-- | tpl/urls/urls_test.go | 17 |
2 files changed, 14 insertions, 11 deletions
diff --git a/tpl/urls/init_test.go b/tpl/urls/init_test.go index a678ee6b1..f88aaf398 100644 --- a/tpl/urls/init_test.go +++ b/tpl/urls/init_test.go @@ -16,13 +16,15 @@ package urls 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/spf13/viper" - "github.com/stretchr/testify/require" ) func TestInit(t *testing.T) { + c := qt.New(t) var found bool var ns *internal.TemplateFuncsNamespace @@ -34,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{}) } diff --git a/tpl/urls/urls_test.go b/tpl/urls/urls_test.go index 7bcef9cd5..9c005d2df 100644 --- a/tpl/urls/urls_test.go +++ b/tpl/urls/urls_test.go @@ -14,14 +14,14 @@ package urls import ( - "fmt" "net/url" "testing" + "github.com/gohugoio/hugo/htesting/hqt" + + qt "github.com/frankban/quicktest" "github.com/gohugoio/hugo/deps" "github.com/spf13/viper" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var ns = New(&deps.Deps{Cfg: viper.New()}) @@ -30,8 +30,9 @@ type tstNoStringer struct{} func TestParse(t *testing.T) { t.Parallel() + c := qt.New(t) - for i, test := range []struct { + for _, test := range []struct { rawurl interface{} expect interface{} }{ @@ -53,16 +54,16 @@ func TestParse(t *testing.T) { // errors {tstNoStringer{}, false}, } { - errMsg := fmt.Sprintf("[%d] %v", i, test) result, err := ns.Parse(test.rawurl) 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.CmpEquals(hqt.DeepAllowUnexported(&url.URL{}, url.Userinfo{})), test.expect) } } |