From 73c4a664b03f8afa8edb527fb6a8cc310bdb3380 Mon Sep 17 00:00:00 2001 From: Anhgelus Morhtuuzh Date: Sat, 20 Dec 2025 18:24:09 +0100 Subject: test(markdown): use subtest to clean --- markdown/ast_paragraph_test.go | 37 ++++++++++--------------------------- 1 file changed, 10 insertions(+), 27 deletions(-) (limited to 'markdown/ast_paragraph_test.go') 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 != "

bonsoir

" { - t.Errorf("failed, got %s", c) - } -} - -func TestParagraph_Replacer(t *testing.T) { - opt := &Option{ - Replaces: map[rune]string{'~': " "}, - } - c, err := Parse("bonsoir", opt) - if err != nil { - t.Fatal(err) - } - if c != "

bonsoir

" { - t.Errorf("failed, got %s", c) - } - c, err = Parse("bonsoir~!", opt) - if err != nil { - t.Fatal(err) - } - if c != "

bonsoir !

" { - t.Errorf("failed, got %s", c) - } + t.Run("paragraph", func(t *testing.T) { + t.Run("simple", test("bonsoir", `

bonsoir

`)) + }) + t.Run("replacer", func(t *testing.T) { + opt := &Option{ + Replaces: map[rune]string{'~': " "}, + } + t.Run("empty", testWithOptions(opt, "bonsoir", `

bonsoir

`)) + t.Run("simple", testWithOptions(opt, "bonsoir~!", `

bonsoir !

`)) + }) } -- cgit v1.2.3