ref: 001dd01ee2fc58e582c2ab7c748cd21137c35a6a
parent: e856f241298b175c7d14228be83affc2e3ecebf6
author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
date: Wed Jan 4 19:00:00 EST 2017
helpers: Remove unusded WordCount
--- a/helpers/content.go
+++ b/helpers/content.go
@@ -421,16 +421,6 @@
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
--- a/helpers/content_test.go
+++ b/helpers/content_test.go
@@ -16,7 +16,6 @@
import (
"bytes"
"html/template"
- "reflect"
"strings"
"testing"
@@ -458,15 +457,5 @@
if wordCount != 400 {
b.Fatal("Wordcount error")
}
- }
-}
-
-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)
}
}
--
⑨