From: Bjørn Erik Pedersen Date: Wed, 4 Jan 2017 23:00:00 +0000 (+0100) Subject: helpers: Remove unusded WordCount X-Git-Tag: v0.19~129 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=001dd01ee2fc58e582c2ab7c748cd21137c35a6a;p=brevno-suite%2Fhugo helpers: Remove unusded WordCount --- diff --git a/helpers/content.go b/helpers/content.go index 9b245972..939be055 100644 --- a/helpers/content.go +++ b/helpers/content.go @@ -421,16 +421,6 @@ func totalWordsOld(s string) int { return len(strings.Fields(s)) } -// WordCount takes content and returns a map of words and count of each word. -func WordCount(s string) map[string]int { - m := make(map[string]int) - for _, f := range strings.Fields(s) { - m[f]++ - } - - return m -} - // TruncateWordsByRune truncates words by runes. func TruncateWordsByRune(words []string, max int) (string, bool) { count := 0 diff --git a/helpers/content_test.go b/helpers/content_test.go index 22c81005..67c50f9d 100644 --- a/helpers/content_test.go +++ b/helpers/content_test.go @@ -16,7 +16,6 @@ package helpers import ( "bytes" "html/template" - "reflect" "strings" "testing" @@ -460,13 +459,3 @@ func BenchmarkTotalWordsOld(b *testing.B) { } } } - -func TestWordCount(t *testing.T) { - testString := "Two, Words!" - expectedMap := map[string]int{"Two,": 1, "Words!": 1} - actualMap := WordCount(testString) - - if !reflect.DeepEqual(expectedMap, actualMap) { - t.Errorf("Actual Map (%v) does not equal expected (%v)", actualMap, expectedMap) - } -}