diff options
| author | Anhgelus Morhtuuzh <william@herges.fr> | 2025-12-20 18:24:09 +0100 |
|---|---|---|
| committer | Anhgelus Morhtuuzh <william@herges.fr> | 2025-12-20 18:24:09 +0100 |
| commit | 73c4a664b03f8afa8edb527fb6a8cc310bdb3380 (patch) | |
| tree | 9ba2d2af2149024ea0dc05a88dfcecb351c90139 /markdown/ast_external_test.go | |
| parent | 90246ee314cfbb6b6f0b43b51e392b6b5293b867 (diff) | |
test(markdown): use subtest to clean
Diffstat (limited to 'markdown/ast_external_test.go')
| -rw-r--r-- | markdown/ast_external_test.go | 34 |
1 files changed, 9 insertions, 25 deletions
diff --git a/markdown/ast_external_test.go b/markdown/ast_external_test.go index c31c233..ec9dd29 100644 --- a/markdown/ast_external_test.go +++ b/markdown/ast_external_test.go @@ -3,35 +3,19 @@ package markdown import "testing" func TestExternal(t *testing.T) { - got, err := Parse("[content](href)", nil) - if err != nil { - t.Fatal(err) - } - if string(got) != `<p><a href="href">content</a></p>` { - t.Errorf("invalid value, got %s", got) - } - - got, err = Parse("", nil) - if err != nil { - t.Fatal(err) - } - if string(got) != `<figure><img alt="image alt" src="image src" /></figure>` { - t.Errorf("invalid value, got %s", got) - } - - got, err = Parse(` + t.Run("link", func(t *testing.T) { + t.Run("simple", test("[content](href)", `<p><a href="href">content</a></p>`)) + t.Run("combo", test("Hey, [link](href)", `<p>Hey, <a href="href">link</a></p>`)) + }) + t.Run("image", func(t *testing.T) { + t.Run("simple", test("", `<figure><img alt="image alt" src="image src" /></figure>`)) + t.Run("combo", test(` Avant la source  source 1 source 2 Hors de la source -`, nil) - if err != nil { - t.Fatal(err) - } - if string(got) != `<p>Avant la source</p><figure><img alt="image alt" src="image src" /><figcaption>source 1 source 2</figcaption></figure><p>Hors de la source</p>` { - t.Errorf("invalid value, got %s", got) - } - +`, `<p>Avant la source</p><figure><img alt="image alt" src="image src" /><figcaption>source 1 source 2</figcaption></figure><p>Hors de la source</p>`)) + }) } |
