(t *testing.T)
| 44 | } |
| 45 | |
| 46 | func TestToTextStripsScript(t *testing.T) { |
| 47 | got := ToText("<p>hello</p><script>alert('xss')</script>") |
| 48 | if strings.Contains(got, "alert") { |
| 49 | t.Errorf("ToText should strip script content, got %q", got) |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | func TestToTextEmpty(t *testing.T) { |
| 54 | got := ToText("") |