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 /metrics/metrics_test.go | |
parent | 6027ee11082d0b9d72de1d4d1980a702be294ad2 (diff) | |
download | hugo-9e571827055dedb46b78c5db3d17d6913f14870b.tar.gz hugo-9e571827055dedb46b78c5db3d17d6913f14870b.zip |
tests: Convert from testify to quicktest
Diffstat (limited to 'metrics/metrics_test.go')
-rw-r--r-- | metrics/metrics_test.go | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/metrics/metrics_test.go b/metrics/metrics_test.go index d22a51733..d4c362b7b 100644 --- a/metrics/metrics_test.go +++ b/metrics/metrics_test.go @@ -19,11 +19,11 @@ import ( "github.com/gohugoio/hugo/resources/page" - "github.com/stretchr/testify/require" + qt "github.com/frankban/quicktest" ) func TestSimilarPercentage(t *testing.T) { - assert := require.New(t) + c := qt.New(t) sentence := "this is some words about nothing, Hugo!" words := strings.Fields(sentence) @@ -32,20 +32,20 @@ func TestSimilarPercentage(t *testing.T) { } sentenceReversed := strings.Join(words, " ") - assert.Equal(100, howSimilar("Hugo Rules", "Hugo Rules")) - assert.Equal(50, howSimilar("Hugo Rules", "Hugo Rocks")) - assert.Equal(66, howSimilar("The Hugo Rules", "The Hugo Rocks")) - assert.Equal(66, howSimilar("The Hugo Rules", "The Hugo")) - assert.Equal(66, howSimilar("The Hugo", "The Hugo Rules")) - assert.Equal(0, howSimilar("Totally different", "Not Same")) - assert.Equal(14, howSimilar(sentence, sentenceReversed)) + c.Assert(howSimilar("Hugo Rules", "Hugo Rules"), qt.Equals, 100) + c.Assert(howSimilar("Hugo Rules", "Hugo Rocks"), qt.Equals, 50) + c.Assert(howSimilar("The Hugo Rules", "The Hugo Rocks"), qt.Equals, 66) + c.Assert(howSimilar("The Hugo Rules", "The Hugo"), qt.Equals, 66) + c.Assert(howSimilar("The Hugo", "The Hugo Rules"), qt.Equals, 66) + c.Assert(howSimilar("Totally different", "Not Same"), qt.Equals, 0) + c.Assert(howSimilar(sentence, sentenceReversed), qt.Equals, 14) } func TestSimilarPercentageNonString(t *testing.T) { - assert := require.New(t) - assert.Equal(100, howSimilar(page.NopPage, page.NopPage)) - assert.Equal(90, howSimilar(page.Pages{}, page.Pages{})) + c := qt.New(t) + c.Assert(howSimilar(page.NopPage, page.NopPage), qt.Equals, 100) + c.Assert(howSimilar(page.Pages{}, page.Pages{}), qt.Equals, 90) } func BenchmarkHowSimilar(b *testing.B) { |