// Copyright 2017 The Gogs Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package markup_test
import (
"testing"
. "github.com/smartystreets/goconvey/convey"
. "gogs.io/gogs/internal/markup"
)
func Test_Sanitizer(t *testing.T) {
NewSanitizer()
Convey("Sanitize HTML string and bytes", t, func() {
testCases := []string{
// Regular
`Google`, `Google`,
// Code highlighting class
``, ``,
``, ``,
``, ``,
// Input checkbox
``, ``,
``, ``,
``, ``,
}
for i := 0; i < len(testCases); i += 2 {
So(Sanitize(testCases[i]), ShouldEqual, testCases[i+1])
So(string(SanitizeBytes([]byte(testCases[i]))), ShouldEqual, testCases[i+1])
}
})
}