diff options
| author | Anhgelus Morhtuuzh <william@herges.fr> | 2025-12-13 17:15:47 +0000 |
|---|---|---|
| committer | Anhgelus Morhtuuzh <william@herges.fr> | 2025-12-13 17:15:47 +0000 |
| commit | 62fa3f77e8215fdaaf72ddb9df4162e0d65148da (patch) | |
| tree | dbf20dca933996cf253fe2d110d8381b0c407b2d /markdown/ast_external_test.go | |
| parent | ae297bbd117835304b298e7d8a2f914111940e77 (diff) | |
| parent | 48311424ba2eaac254864c008b6d18e8510f827d (diff) | |
Merge pull request '[Refactor] Replace manual DOM manipulation in markdown by cleaner one' (#2) from refactor/mardown-dom into main
Reviewed-on: https://git.anhgelus.world/anhgelus/small-web/pulls/2
Diffstat (limited to 'markdown/ast_external_test.go')
| -rw-r--r-- | markdown/ast_external_test.go | 29 |
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("") - tree, err = ast(lxs) + got, err = Parse("", 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  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) } |
