package main import ( "strings" "testing" ) func TestMarkdownToHtmlBasics(t *testing.T) { failTestOnError(t, setupTestEnv()) // basic markdown and expected html tests tests := map[string]string{ "Foo": "
Foo
", "Foo\n\nBar": "Foo
\n\nBar
", "XSS: Foo": "XSS: Foo
", "Regular [Link](http://example.com)": "Regular Link
", "XSS [Link](data:text/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pgo=)": "XSS Link
", "![Images disallowed](http://example.com/image.jpg)": "", "**bold** *italics*": "bold italics
", "http://example.com/autolink": "", "not bold": "not bold
", } for in, out := range tests { html := strings.TrimSpace(markdownToHtml(in)) if html != out { t.Errorf("for in=[%s] expected out=[%s] got out=[%s]", in, out, html) return } } }