aboutsummaryrefslogtreecommitdiff
path: root/markdown/ast_external_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'markdown/ast_external_test.go')
-rw-r--r--markdown/ast_external_test.go34
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("![image alt](image src)", 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("![image alt](image src)", `<figure><img alt="image alt" src="image src" /></figure>`))
+ 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) != `<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>`))
+ })
}