Added more tests
This commit is contained in:
parent
862f9837e4
commit
302fd393c8
@ -58,6 +58,7 @@ func Render(markdown string) string {
|
||||
|
||||
default:
|
||||
if len(line) == 0 {
|
||||
flush()
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@ func TestParagraph(t *testing.T) {
|
||||
assert.Equal(t, markdown.Render("Text\n\n"), "<p>Text</p>")
|
||||
assert.Equal(t, markdown.Render("Text\n\n\n"), "<p>Text</p>")
|
||||
assert.Equal(t, markdown.Render("Line 1\nLine 2"), "<p>Line 1 Line 2</p>")
|
||||
assert.Equal(t, markdown.Render("Line 1\n\nLine 2"), "<p>Line 1</p><p>Line 2</p>")
|
||||
}
|
||||
|
||||
func TestHeader(t *testing.T) {
|
||||
@ -38,6 +39,7 @@ func TestLink(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCombined(t *testing.T) {
|
||||
assert.Equal(t, markdown.Render("# Header\n\nLine 1."), "<h1>Header</h1><p>Line 1.</p>")
|
||||
assert.Equal(t, markdown.Render("# Header\nLine 1.\nLine 2.\nLine 3."), "<h1>Header</h1><p>Line 1. Line 2. Line 3.</p>")
|
||||
assert.Equal(t, markdown.Render("# Header 1\nLine 1.\n# Header 2\nLine 2."), "<h1>Header 1</h1><p>Line 1.</p><h1>Header 2</h1><p>Line 2.</p>")
|
||||
assert.Equal(t, markdown.Render("# [Header Link](https://example.com/)"), "<h1><a href=\"https://example.com/\">Header Link</a></h1>")
|
||||
|
Loading…
Reference in New Issue
Block a user