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_code_test.go | 33 ++++++--------------------------- 1 file changed, 6 insertions(+), 27 deletions(-) (limited to 'markdown/ast_code_test.go') diff --git a/markdown/ast_code_test.go b/markdown/ast_code_test.go index b116544..f9c57f3 100644 --- a/markdown/ast_code_test.go +++ b/markdown/ast_code_test.go @@ -3,31 +3,10 @@ package markdown import "testing" func TestCode(t *testing.T) { - got, err := Parse("`mono`", nil) - if err != nil { - t.Fatal(err) - } - if string(got) != `

mono

` { - t.Errorf("invalid value, got %s", got) - } - - got, err = Parse("bonjour `code` !", nil) - if err != nil { - t.Fatal(err) - } - if string(got) != `

bonjour code !

` { - t.Errorf("invalid value, got %s", got) - } - - got, err = Parse( - "```\n"+"raw\nhehe"+"```", - nil, - ) - if err != nil { - t.Fatal(err) - } - if string(got) != `
raw
-hehe
` { - t.Errorf("invalid value, got %s", got) - } + t.Run("code", func(t *testing.T) { + t.Run("mono", test("`mono`", `

mono

`)) + t.Run("combo", test("bonjour `code` !", `

bonjour code !

`)) + t.Run("mult-line", test("```\n"+"raw\nhehe"+"```", `
raw
+hehe
`)) + }) } -- cgit v1.2.3