aboutsummaryrefslogtreecommitdiff
path: root/markdown/ast_paragraph_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'markdown/ast_paragraph_test.go')
-rw-r--r--markdown/ast_paragraph_test.go37
1 files changed, 10 insertions, 27 deletions
diff --git a/markdown/ast_paragraph_test.go b/markdown/ast_paragraph_test.go
index 2014ab9..ab3ab6c 100644
--- a/markdown/ast_paragraph_test.go
+++ b/markdown/ast_paragraph_test.go
@@ -3,31 +3,14 @@ package markdown
import "testing"
func TestParagraph(t *testing.T) {
- c, err := Parse("bonsoir", nil)
- if err != nil {
- t.Fatal(err)
- }
- if c != "<p>bonsoir</p>" {
- t.Errorf("failed, got %s", c)
- }
-}
-
-func TestParagraph_Replacer(t *testing.T) {
- opt := &Option{
- Replaces: map[rune]string{'~': "&thinsp;"},
- }
- c, err := Parse("bonsoir", opt)
- if err != nil {
- t.Fatal(err)
- }
- if c != "<p>bonsoir</p>" {
- t.Errorf("failed, got %s", c)
- }
- c, err = Parse("bonsoir~!", opt)
- if err != nil {
- t.Fatal(err)
- }
- if c != "<p>bonsoir&thinsp;!</p>" {
- t.Errorf("failed, got %s", c)
- }
+ 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>`))
+ })
}