aboutsummaryrefslogtreecommitdiff
path: root/markdown/ast_paragraph_test.go
blob: c18dfc777e8543835e5b144500e09fa2cdbc2820 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package markdown

import "testing"

func TestParagraph(t *testing.T) {
	t.Run("paragraph", func(t *testing.T) {
		t.Run("simple", test("bonsoir", `<p>bonsoir</p>`))
	})
	t.Run("replacer", func(t *testing.T) {
		opt := &Option{Replaces: map[rune]string{'~': "&thinsp;"}}
		t.Run("empty", testWithOptions(opt, "bonsoir", `<p>bonsoir</p>`))
		t.Run("simple", testWithOptions(opt, "bonsoir~!", `<p>bonsoir&thinsp;!</p>`))
	})
	t.Run("poem", func(t *testing.T) {
		opt := &Option{Poem: true}
		t.Run("simple", testWithOptions(opt, "bonsoir", `<p>bonsoir</p>`))
		t.Run("one_break", testWithOptions(opt, `bonsoir
world`, `<p>bonsoir<br />world</p>`))
		t.Run("mult_break", testWithOptions(opt, `bonsoir
world

new line`, `<p>bonsoir<br />world</p><p>new line</p>`))
	})
}