github.com/MontFerret/ferret@v0.18.0/pkg/stdlib/strings/escape_test.go (about) 1 package strings_test 2 3 import ( 4 "context" 5 "testing" 6 7 "github.com/MontFerret/ferret/pkg/runtime/values" 8 9 "github.com/MontFerret/ferret/pkg/stdlib/strings" 10 11 . "github.com/smartystreets/goconvey/convey" 12 ) 13 14 func TestEscapeHTML(t *testing.T) { 15 Convey("EscapeHTML", t, func() { 16 Convey("Should escape an HTML string", func() { 17 out, err := strings.EscapeHTML(context.Background(), values.NewString(`<body><span>Foobar</span></body>`)) 18 19 So(err, ShouldBeNil) 20 So(out, ShouldEqual, values.NewString("<body><span>Foobar</span></body>")) 21 }) 22 }) 23 }