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:
@@ -29,9 +29,9 @@ import (
|
||||
|
||||
"github.com/gohugoio/hugo/deps"
|
||||
|
||||
qt "github.com/frankban/quicktest"
|
||||
"github.com/gohugoio/hugo/config"
|
||||
"github.com/gohugoio/hugo/hugofs"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
var logger = loggers.NewErrorLogger()
|
||||
@@ -179,19 +179,19 @@ func doTestI18nTranslate(t testing.TB, test i18nTest, cfg config.Provider) strin
|
||||
}
|
||||
|
||||
func prepareTranslationProvider(t testing.TB, test i18nTest, cfg config.Provider) *TranslationProvider {
|
||||
assert := require.New(t)
|
||||
c := qt.New(t)
|
||||
fs := hugofs.NewMem(cfg)
|
||||
|
||||
for file, content := range test.data {
|
||||
err := afero.WriteFile(fs.Source, filepath.Join("i18n", file), []byte(content), 0755)
|
||||
assert.NoError(err)
|
||||
c.Assert(err, qt.IsNil)
|
||||
}
|
||||
|
||||
tp := NewTranslationProvider()
|
||||
depsCfg := newDepsConfig(tp, cfg, fs)
|
||||
d, err := deps.New(depsCfg)
|
||||
assert.NoError(err)
|
||||
assert.NoError(d.LoadResources())
|
||||
c.Assert(err, qt.IsNil)
|
||||
c.Assert(d.LoadResources(), qt.IsNil)
|
||||
|
||||
return tp
|
||||
}
|
||||
@@ -233,6 +233,7 @@ func getConfig() *viper.Viper {
|
||||
}
|
||||
|
||||
func TestI18nTranslate(t *testing.T) {
|
||||
c := qt.New(t)
|
||||
var actual, expected string
|
||||
v := getConfig()
|
||||
|
||||
@@ -247,7 +248,7 @@ func TestI18nTranslate(t *testing.T) {
|
||||
expected = test.expected
|
||||
}
|
||||
actual = doTestI18nTranslate(t, test, v)
|
||||
require.Equal(t, expected, actual)
|
||||
c.Assert(actual, qt.Equals, expected)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user