From 9e571827055dedb46b78c5db3d17d6913f14870b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Sat, 10 Aug 2019 21:05:17 +0200 Subject: tests: Convert from testify to quicktest --- tpl/urls/init_test.go | 8 +++++--- tpl/urls/urls_test.go | 17 +++++++++-------- 2 files changed, 14 insertions(+), 11 deletions(-) (limited to 'tpl/urls') 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) } } -- cgit v1.2.3