tests: Convert from testify to quicktest

This commit is contained in:
Bjørn Erik Pedersen 2019-08-10 21:05:17 +02:00
parent 6027ee1108
commit 9e57182705
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F
195 changed files with 3919 additions and 3693 deletions

View file

@ -27,7 +27,7 @@ import (
"github.com/gohugoio/hugo/langs"
"github.com/stretchr/testify/require"
qt "github.com/frankban/quicktest"
"github.com/gohugoio/hugo/hugofs"
"github.com/spf13/afero"
@ -35,6 +35,7 @@ import (
)
func TestMakePath(t *testing.T) {
c := qt.New(t)
tests := []struct {
input string
expected string
@ -61,7 +62,7 @@ func TestMakePath(t *testing.T) {
l := langs.NewDefaultLanguage(v)
p, err := NewPathSpec(hugofs.NewMem(v), l, nil)
require.NoError(t, err)
c.Assert(err, qt.IsNil)
output := p.MakePath(test.input)
if output != test.expected {
@ -547,8 +548,8 @@ func TestAbsPathify(t *testing.T) {
}
func TestExtNoDelimiter(t *testing.T) {
assert := require.New(t)
assert.Equal("json", ExtNoDelimiter(filepath.FromSlash("/my/data.json")))
c := qt.New(t)
c.Assert(ExtNoDelimiter(filepath.FromSlash("/my/data.json")), qt.Equals, "json")
}
func TestFilename(t *testing.T) {
@ -636,11 +637,11 @@ func TestExtractAndGroupRootPaths(t *testing.T) {
result := ExtractAndGroupRootPaths(in)
assert := require.New(t)
assert.Equal(filepath.FromSlash("[/a/b/{c,e} /c/d/e]"), fmt.Sprint(result))
c := qt.New(t)
c.Assert(fmt.Sprint(result), qt.Equals, filepath.FromSlash("[/a/b/{c,e} /c/d/e]"))
// Make sure the original is preserved
assert.Equal(inCopy, in)
c.Assert(in, qt.DeepEquals, inCopy)
}