diff options
author | Marek Stanley <marek.stanley@ymail.com> | 2015-01-07 21:40:35 +0100 |
---|---|---|
committer | bep <bjorn.erik.pedersen@gmail.com> | 2015-01-09 12:42:13 +0100 |
commit | 49f5eb5c845b0978ac1227e5c6a2508d6cd93691 (patch) | |
tree | bc1697f60f9c905641bdcbf78f86546dbf7d5790 /helpers/content_test.go | |
parent | 2b46f3e51ee64aa3611ddc76197abf40d4f3644c (diff) |
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.
Diffstat (limited to 'helpers/content_test.go')
-rw-r--r-- | helpers/content_test.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/helpers/content_test.go b/helpers/content_test.go new file mode 100644 index 000000000..18cdfcc5d --- /dev/null +++ b/helpers/content_test.go @@ -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) + } + } +} |