diff options
author | Bjørn Erik Pedersen <[email protected]> | 2019-08-10 21:05:17 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2019-08-12 13:26:32 +0200 |
commit | 9e571827055dedb46b78c5db3d17d6913f14870b (patch) | |
tree | f5f0108afe0c9385ff6dc27664943d9f719f57ad /langs | |
parent | 6027ee11082d0b9d72de1d4d1980a702be294ad2 (diff) | |
download | hugo-9e571827055dedb46b78c5db3d17d6913f14870b.tar.gz hugo-9e571827055dedb46b78c5db3d17d6913f14870b.zip |
tests: Convert from testify to quicktest
Diffstat (limited to 'langs')
-rw-r--r-- | langs/i18n/i18n_test.go | 13 | ||||
-rw-r--r-- | langs/language_test.go | 13 |
2 files changed, 14 insertions, 12 deletions
diff --git a/langs/i18n/i18n_test.go b/langs/i18n/i18n_test.go index e08210848..d9215952a 100644 --- a/langs/i18n/i18n_test.go +++ b/langs/i18n/i18n_test.go @@ -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) } } } diff --git a/langs/language_test.go b/langs/language_test.go index 8783172fb..97abe77cc 100644 --- a/langs/language_test.go +++ b/langs/language_test.go @@ -16,11 +16,12 @@ package langs import ( "testing" + qt "github.com/frankban/quicktest" "github.com/spf13/viper" - "github.com/stretchr/testify/require" ) func TestGetGlobalOnlySetting(t *testing.T) { + c := qt.New(t) v := viper.New() v.Set("defaultContentLanguageInSubdir", true) v.Set("contentDir", "content") @@ -29,12 +30,12 @@ func TestGetGlobalOnlySetting(t *testing.T) { lang.Set("defaultContentLanguageInSubdir", false) lang.Set("paginatePath", "side") - require.True(t, lang.GetBool("defaultContentLanguageInSubdir")) - require.Equal(t, "side", lang.GetString("paginatePath")) + c.Assert(lang.GetBool("defaultContentLanguageInSubdir"), qt.Equals, true) + c.Assert(lang.GetString("paginatePath"), qt.Equals, "side") } func TestLanguageParams(t *testing.T) { - assert := require.New(t) + c := qt.New(t) v := viper.New() v.Set("p1", "p1cfg") @@ -43,6 +44,6 @@ func TestLanguageParams(t *testing.T) { lang := NewDefaultLanguage(v) lang.SetParam("p1", "p1p") - assert.Equal("p1p", lang.Params()["p1"]) - assert.Equal("p1cfg", lang.Get("p1")) + c.Assert(lang.Params()["p1"], qt.Equals, "p1p") + c.Assert(lang.Get("p1"), qt.Equals, "p1cfg") } |