diff --git a/main.go b/main.go index dce2248..7fe0326 100644 --- a/main.go +++ b/main.go @@ -74,7 +74,6 @@ func stripTabAndSpaceFromLine(text string) []string { flatWords = append(flatWords, word) } } - return flatWords } diff --git a/main_test.go b/main_test.go index 0a1e922..d49695b 100644 --- a/main_test.go +++ b/main_test.go @@ -72,3 +72,18 @@ func TestCharCount(t *testing.T) { t.Logf("countChars(%s), PASSED.\n", testFile) } } + +func TestStripTabandSpaceFromLine(t *testing.T) { + line := "hello world. today." + outputSlice := []string{"hello", "world.", "today."} + + stripLine := stripTabAndSpaceFromLine(line) + + isEqual := reflect.DeepEqual(outputSlice, stripLine) + + if isEqual != true { + t.Errorf("stripTabAndSpaceFromLine(%s), FAILED. Expected %v got %v \n", line, outputSlice, stripLine) + } else { + t.Logf("stripTabAndSpaceFromLine(%s), PASSED.\n", line) + } +}