38 lines
639 B
Go
38 lines
639 B
Go
package checker_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/cinar/checker"
|
|
)
|
|
|
|
func TestNormalizeHTMLUnescapeNonString(t *testing.T) {
|
|
defer checker.FailIfNoPanic(t)
|
|
|
|
type Comment struct {
|
|
Body int `checkers:"html-unescape"`
|
|
}
|
|
|
|
comment := &Comment{}
|
|
|
|
checker.Check(comment)
|
|
}
|
|
|
|
func TestNormalizeHTMLUnescape(t *testing.T) {
|
|
type Comment struct {
|
|
Body string `checkers:"html-unescape"`
|
|
}
|
|
|
|
comment := &Comment{
|
|
Body: "<tag> "Checker" & 'Library' </tag>",
|
|
}
|
|
|
|
_, valid := checker.Check(comment)
|
|
if !valid {
|
|
t.Fail()
|
|
}
|
|
|
|
if comment.Body != "<tag> \"Checker\" & 'Library' </tag>" {
|
|
t.Fail()
|
|
}
|
|
}
|