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.go29
1 files changed, 6 insertions, 23 deletions
diff --git a/markdown/ast_external_test.go b/markdown/ast_external_test.go
index 514cc89..c31c233 100644
--- a/markdown/ast_external_test.go
+++ b/markdown/ast_external_test.go
@@ -3,51 +3,34 @@ package markdown
import "testing"
func TestExternal(t *testing.T) {
- lxs := lex("[content](href)")
- tree, err := ast(lxs)
- if err != nil {
- t.Fatal(err)
- }
- got, err := tree.Eval(nil)
+ 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)
- t.Logf("lexer %s", lxs.String())
}
- lxs = lex("![image alt](image src)")
- tree, err = ast(lxs)
+ got, err = Parse("![image alt](image src)", nil)
if err != nil {
- t.Logf("lexer %s", lxs.String())
t.Fatal(err)
}
- got, err = tree.Eval(nil)
- if err != nil {
- t.Fatal(err)
- }
- if string(got) != `<figure><img alt="image alt" src="image src"></figure>` {
+ if string(got) != `<figure><img alt="image alt" src="image src" /></figure>` {
t.Errorf("invalid value, got %s", got)
}
- lxs = lex(`
+ got, err = Parse(`
Avant la source
![image alt](image src)
source 1
source 2
Hors de la source
-`)
- tree, err = ast(lxs)
- if err != nil {
- t.Fatal(err)
- }
- got, err = tree.Eval(nil)
+`, 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>` {
+ 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)
}