Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tpl
diff options
context:
space:
mode:
authorbep <bjorn.erik.pedersen@gmail.com>2015-01-20 14:23:27 +0300
committerbep <bjorn.erik.pedersen@gmail.com>2015-01-20 14:23:27 +0300
commit26856c3b7555d3b1973de2349af7d680d755e58a (patch)
treee6d0f293363551a21923c6926e6edffb31e8e887 /tpl
parent4b1780bf698465688d15d10a22d705f997dc64a5 (diff)
Add tests for Trim
Diffstat (limited to 'tpl')
-rw-r--r--tpl/template_test.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/tpl/template_test.go b/tpl/template_test.go
index 9a726f3fa..12c7ed28a 100644
--- a/tpl/template_test.go
+++ b/tpl/template_test.go
@@ -4,6 +4,7 @@ import (
"bytes"
"errors"
"fmt"
+ "github.com/stretchr/testify/assert"
"html/template"
"reflect"
"testing"
@@ -852,6 +853,16 @@ func TestChomp(t *testing.T) {
}
}
+func TestTrim(t *testing.T) {
+ v, _ := Trim("1234 my way 13", "123")
+ assert.Equal(t, "4 my way ", v)
+ v, _ = Trim(" my way ", " ")
+ v, _ = Trim(1234, "14")
+ assert.Equal(t, "23", v)
+ _, e := Trim(tstNoStringer{}, " ")
+ assert.NotNil(t, e, "tstNoStringer isn't trimmable")
+}
+
func TestSafeHtml(t *testing.T) {
for i, this := range []struct {
str string