Added a test for Terms.WriteTo

This commit is contained in:
Brandon Dyck 2019-04-28 17:05:24 -06:00
parent 90b6e52798
commit b3fd1d386b

View File

@ -178,6 +178,21 @@ func TestParentElement(t *testing.T) {
properties.TestingRun(t) properties.TestingRun(t)
} }
func TestTerms(t *testing.T) {
properties := gopter.NewProperties(nil)
properties.Property("WriteTo writes the concatenation of calling WriteTo on the slice contents", prop.ForAll(
func(terms []hatmill.Term) bool {
var expected string
for _, term := range terms {
expected += string(term.(hatmill.Text))
}
return checkWrite(hatmill.Terms(terms), expected)
},
gen.SliceOf(htmlTextGen),
))
}
func Example() { func Example() {
userInput := "<script>launchMissiles();</script>" userInput := "<script>launchMissiles();</script>"