diff options
author | Owen Waller <o.waller@kulawe.com> | 2014-09-10 18:30:03 +0100 |
---|---|---|
committer | spf13 <steve.francia@gmail.com> | 2014-11-04 11:13:41 -0500 |
commit | 57cd9539978172dcfb539aa700aa1c1faeef9045 (patch) | |
tree | 3906e2a1d1572d1780cf5fe234a962a2b39406a5 /helpers/general_test.go | |
parent | b87402e8cd8a95cc0fcad5ab7ec06a1b765bf1cd (diff) |
Added the general modules test files
Added the new general module's test file, general_test.go. This replaces the
helpers_test.go file.
There is also a minor defect fix in general.go's StripHTML function.
The correct xhtml tag for a break is <br /> not </br>. I've also removed
the unnecessary spaces before the replacement "\n".
The new test module also reflects this change.
Conflicts:
helpers/general.go
Diffstat (limited to 'helpers/general_test.go')
-rw-r--r-- | helpers/general_test.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/helpers/general_test.go b/helpers/general_test.go new file mode 100644 index 000000000..18cdfcc5d --- /dev/null +++ b/helpers/general_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) + } + } +} |