package nbtohtml import ( "html/template" "testing" "github.com/stretchr/testify/assert" ) func TestEscapeHTML(t *testing.T) { expected := template.HTML( "<p>Hello world</p>\n<script>window.alert('I'm evil!');</script>", ) actual := escapeHTML(`
Hello world
`) assert.Equal(t, expected, actual) } func TestSanitizeHTML(t *testing.T) { expected := template.HTML("Hello world
\n") actual := sanitizeHTML(`Hello world
`) assert.Equal(t, expected, actual) }