aboutsummaryrefslogtreecommitdiffhomepage
path: root/codegen
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 /codegen
parent6027ee11082d0b9d72de1d4d1980a702be294ad2 (diff)
downloadhugo-9e571827055dedb46b78c5db3d17d6913f14870b.tar.gz
hugo-9e571827055dedb46b78c5db3d17d6913f14870b.zip
tests: Convert from testify to quicktest
Diffstat (limited to 'codegen')
-rw-r--r--codegen/methods_test.go38
1 files changed, 19 insertions, 19 deletions
diff --git a/codegen/methods_test.go b/codegen/methods_test.go
index fad6da078..77399f4e4 100644
--- a/codegen/methods_test.go
+++ b/codegen/methods_test.go
@@ -20,8 +20,8 @@ import (
"reflect"
"testing"
+ qt "github.com/frankban/quicktest"
"github.com/gohugoio/hugo/common/herrors"
- "github.com/stretchr/testify/require"
)
func TestMethods(t *testing.T) {
@@ -33,47 +33,47 @@ func TestMethods(t *testing.T) {
)
dir, _ := os.Getwd()
- c := NewInspector(dir)
+ insp := NewInspector(dir)
t.Run("MethodsFromTypes", func(t *testing.T) {
- assert := require.New(t)
+ c := qt.New(t)
- methods := c.MethodsFromTypes([]reflect.Type{zeroI}, nil)
+ methods := insp.MethodsFromTypes([]reflect.Type{zeroI}, nil)
methodsStr := fmt.Sprint(methods)
- assert.Contains(methodsStr, "Method1(arg0 herrors.ErrorContext)")
- assert.Contains(methodsStr, "Method7() interface {}")
- assert.Contains(methodsStr, "Method0() string\n Method4() string")
- assert.Contains(methodsStr, "MethodEmbed3(arg0 string) string\n MethodEmbed1() string")
+ c.Assert(methodsStr, qt.Contains, "Method1(arg0 herrors.ErrorContext)")
+ c.Assert(methodsStr, qt.Contains, "Method7() interface {}")
+ c.Assert(methodsStr, qt.Contains, "Method0() string\n Method4() string")
+ c.Assert(methodsStr, qt.Contains, "MethodEmbed3(arg0 string) string\n MethodEmbed1() string")
- assert.Contains(methods.Imports(), "github.com/gohugoio/hugo/common/herrors")
+ c.Assert(methods.Imports(), qt.Contains, "github.com/gohugoio/hugo/common/herrors")
})
t.Run("EmbedOnly", func(t *testing.T) {
- assert := require.New(t)
+ c := qt.New(t)
- methods := c.MethodsFromTypes([]reflect.Type{zeroIEOnly}, nil)
+ methods := insp.MethodsFromTypes([]reflect.Type{zeroIEOnly}, nil)
methodsStr := fmt.Sprint(methods)
- assert.Contains(methodsStr, "MethodEmbed3(arg0 string) string")
+ c.Assert(methodsStr, qt.Contains, "MethodEmbed3(arg0 string) string")
})
t.Run("ToMarshalJSON", func(t *testing.T) {
- assert := require.New(t)
+ c := qt.New(t)
- m, pkg := c.MethodsFromTypes(
+ m, pkg := insp.MethodsFromTypes(
[]reflect.Type{zeroI},
[]reflect.Type{zeroIE}).ToMarshalJSON("*page", "page")
- assert.Contains(m, "method6 := p.Method6()")
- assert.Contains(m, "Method0: method0,")
- assert.Contains(m, "return json.Marshal(&s)")
+ c.Assert(m, qt.Contains, "method6 := p.Method6()")
+ c.Assert(m, qt.Contains, "Method0: method0,")
+ c.Assert(m, qt.Contains, "return json.Marshal(&s)")
- assert.Contains(pkg, "github.com/gohugoio/hugo/common/herrors")
- assert.Contains(pkg, "encoding/json")
+ c.Assert(pkg, qt.Contains, "github.com/gohugoio/hugo/common/herrors")
+ c.Assert(pkg, qt.Contains, "encoding/json")
fmt.Println(pkg)