aboutsummaryrefslogtreecommitdiff
path: root/markdown/ast_code_test.go
diff options
context:
space:
mode:
authorAnhgelus Morhtuuzh <william@herges.fr>2025-12-20 18:24:09 +0100
committerAnhgelus Morhtuuzh <william@herges.fr>2025-12-20 18:24:09 +0100
commit73c4a664b03f8afa8edb527fb6a8cc310bdb3380 (patch)
tree9ba2d2af2149024ea0dc05a88dfcecb351c90139 /markdown/ast_code_test.go
parent90246ee314cfbb6b6f0b43b51e392b6b5293b867 (diff)
test(markdown): use subtest to clean
Diffstat (limited to 'markdown/ast_code_test.go')
-rw-r--r--markdown/ast_code_test.go33
1 files changed, 6 insertions, 27 deletions
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) != `<p><code>mono</code></p>` {
- t.Errorf("invalid value, got %s", got)
- }
-
- got, err = Parse("bonjour `code` !", nil)
- if err != nil {
- t.Fatal(err)
- }
- if string(got) != `<p>bonjour <code>code</code> !</p>` {
- t.Errorf("invalid value, got %s", got)
- }
-
- got, err = Parse(
- "```\n"+"raw\nhehe"+"```",
- nil,
- )
- if err != nil {
- t.Fatal(err)
- }
- if string(got) != `<pre><code>raw
-hehe</code></pre>` {
- t.Errorf("invalid value, got %s", got)
- }
+ t.Run("code", func(t *testing.T) {
+ t.Run("mono", test("`mono`", `<p><code>mono</code></p>`))
+ t.Run("combo", test("bonjour `code` !", `<p>bonjour <code>code</code> !</p>`))
+ t.Run("mult-line", test("```\n"+"raw\nhehe"+"```", `<pre><code>raw
+hehe</code></pre>`))
+ })
}