Add support for template.URL

Fixes #13
This commit is contained in:
bep 2015-06-07 18:35:28 +02:00 committed by spf13
parent 4d07383ffe
commit 893a4154d1
2 changed files with 3 additions and 0 deletions

View File

@ -37,6 +37,7 @@ func TestToString(t *testing.T) {
assert.Equal(t, ToString(8.12), "8.12")
assert.Equal(t, ToString([]byte("one time")), "one time")
assert.Equal(t, ToString(template.HTML("one time")), "one time")
assert.Equal(t, ToString(template.URL("http://somehost.foo")), "http://somehost.foo")
assert.Equal(t, ToString(foo), "one more time")
assert.Equal(t, ToString(nil), "")
}

View File

@ -194,6 +194,8 @@ func ToStringE(i interface{}) (string, error) {
return string(s), nil
case template.HTML:
return string(s), nil
case template.URL:
return string(s), nil
case nil:
return "", nil
case fmt.Stringer: