Moved a test regarding a content.go function to a new test file content_test.go.

Added some tests for general helpers, especially as a way to document the expected behavior,
and as a warm-up welcome contribution.
This commit is contained in:
Marek Stanley
2015-01-07 21:40:35 +01:00
committed by bep
parent 2b46f3e51e
commit 49f5eb5c84
2 changed files with 97 additions and 9 deletions

22
helpers/content_test.go Normal file
View File

@@ -0,0 +1,22 @@
package helpers
import (
"testing"
)
func TestStripHTML(t *testing.T) {
type test struct {
input, expected string
}
data := []test{
{"<h1>strip h1 tag <h1>", "strip h1 tag "},
{"<p> strip p tag </p>", " strip p tag \n"},
{"</br> strip br<br>", " strip br\n"},
}
for i, d := range data {
output := StripHTML(d.input)
if d.expected != output {
t.Errorf("Test %d failed. Expected %q got %q", i, d.expected, output)
}
}
}