mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
Add tests for Trim
This commit is contained in:
parent
4b1780bf69
commit
26856c3b75
1 changed files with 11 additions and 0 deletions
|
@ -4,6 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
"html/template"
|
"html/template"
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"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) {
|
func TestSafeHtml(t *testing.T) {
|
||||||
for i, this := range []struct {
|
for i, this := range []struct {
|
||||||
str string
|
str string
|
||||||
|
|
Loading…
Reference in a new issue