mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-26 22:04:32 +02:00
tests: Convert from testify to quicktest
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user