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_external_test.go | 34 +++++++++------------------------- 1 file changed, 9 insertions(+), 25 deletions(-) (limited to 'markdown/ast_external_test.go') 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) != `

content

` { - t.Errorf("invalid value, got %s", got) - } - - got, err = Parse("![image alt](image src)", nil) - if err != nil { - t.Fatal(err) - } - if string(got) != `
image alt
` { - t.Errorf("invalid value, got %s", got) - } - - got, err = Parse(` + t.Run("link", func(t *testing.T) { + t.Run("simple", test("[content](href)", `

content

`)) + t.Run("combo", test("Hey, [link](href)", `

Hey, link

`)) + }) + t.Run("image", func(t *testing.T) { + t.Run("simple", test("![image alt](image src)", `
image alt
`)) + t.Run("combo", test(` Avant la source ![image alt](image src) source 1 source 2 Hors de la source -`, nil) - if err != nil { - t.Fatal(err) - } - if string(got) != `

Avant la source

image alt
source 1 source 2

Hors de la source

` { - t.Errorf("invalid value, got %s", got) - } - +`, `

Avant la source

image alt
source 1 source 2

Hors de la source

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