// Copyright 2015 - Present, The Gogs Authors. All rights reserved. // Copyright 2018 - Present, Gitote. All rights reserved. // // This source code is licensed under the MIT license found in the // LICENSE file in the root directory of this source tree. package markup_test import ( . "gitote/gitote/pkg/markup" "testing" . "github.com/smartystreets/goconvey/convey" ) 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]) } }) }