diff options
| author | Anhgelus Morhtuuzh <william@herges.fr> | 2025-10-01 09:14:02 +0200 |
|---|---|---|
| committer | Anhgelus Morhtuuzh <william@herges.fr> | 2025-10-01 09:14:02 +0200 |
| commit | ce5cf951ac6228f96f6f51e3c9e4d8af24702b55 (patch) | |
| tree | 77158890fb5cece21a30515821a6f066ce370377 | |
| parent | 9e5734cf76585705e259ae6c3585980ce8b994c1 (diff) | |
test(markdown): split in multiple files
| -rw-r--r-- | design/index.html | 2 | ||||
| -rw-r--r-- | mardown/ast_modifier_test.go | 22 | ||||
| -rw-r--r-- | mardown/ast_paragraph_test.go | 20 | ||||
| -rw-r--r-- | mardown/ast_quote_test.go | 23 | ||||
| -rw-r--r-- | mardown/ast_test.go | 61 |
5 files changed, 66 insertions, 62 deletions
diff --git a/design/index.html b/design/index.html index da598ec..ed27fd1 100644 --- a/design/index.html +++ b/design/index.html @@ -32,7 +32,7 @@ <article> <h2><a href="log.html">Article title</a></h2> <figure> - <a href="log.html"><<img src="https://placehold.co/1920x1080" alt=""></a> + <a href="log.html"><img src="https://placehold.co/1920x1080" alt=""></a> <figcaption>A placeholder.</figcaption> </figure> <p> diff --git a/mardown/ast_modifier_test.go b/mardown/ast_modifier_test.go new file mode 100644 index 0000000..d805f22 --- /dev/null +++ b/mardown/ast_modifier_test.go @@ -0,0 +1,22 @@ +package mardown + +import "testing" + +func TestModifier(t *testing.T) { + content := ` +***bon*soir** +` + lxs := lex(content) + tree, err := ast(lxs) + if err != nil { + t.Fatal(err) + } + c, err := tree.Eval() + if err != nil { + t.Fatal(err) + } + if c != "<p><b><em>bon</em>soir</b></p>" { + t.Errorf("failed, got %s", c) + t.Logf("lxs: %s\ntree: %s", lxs, tree) + } +} diff --git a/mardown/ast_paragraph_test.go b/mardown/ast_paragraph_test.go new file mode 100644 index 0000000..8daba99 --- /dev/null +++ b/mardown/ast_paragraph_test.go @@ -0,0 +1,20 @@ +package mardown + +import "testing" + +func TestParagraph(t *testing.T) { + content := "bonsoir" + lxs := lex(content) + tree, err := ast(lxs) + if err != nil { + t.Fatal(err) + } + c, err := tree.Eval() + if err != nil { + t.Fatal(err) + } + if c != "<p>bonsoir</p>" { + t.Errorf("failed, got %s", c) + t.Logf("lxs: %s\ntree: %s", lxs, tree) + } +} diff --git a/mardown/ast_quote_test.go b/mardown/ast_quote_test.go new file mode 100644 index 0000000..c3c7b3b --- /dev/null +++ b/mardown/ast_quote_test.go @@ -0,0 +1,23 @@ +package mardown + +import "testing" + +func TestQuote(t *testing.T) { + content := ` +> Bonsoir, je suis un **code** +avec une source +` + lxs := lex(content) + tree, err := ast(lxs) + if err != nil { + t.Fatal(err) + } + c, err := tree.Eval() + if err != nil { + t.Fatal(err) + } + if c != `<div class="quote"><blockquote>Bonsoir, je suis un <b>code</b></blockquote><p>avec une source</p></div>` { + t.Errorf("failed, got %s", c) + t.Logf("lxs: %s\ntree: %s", lxs, tree) + } +} diff --git a/mardown/ast_test.go b/mardown/ast_test.go index d9033c2..4114150 100644 --- a/mardown/ast_test.go +++ b/mardown/ast_test.go @@ -3,65 +3,4 @@ package mardown import "testing" func TestAst(t *testing.T) { - content := "bonsoir" - lxs := lex(content) - tree, err := ast(lxs) - if err != nil { - t.Fatal(err) - } - c, err := tree.Eval() - if err != nil { - t.Fatal(err) - } - if c != "<p>bonsoir</p>" { - t.Errorf("failed, got %s", c) - t.Logf("lxs: %s\ntree: %s", lxs, tree) - } - content = ` -***bon*soir** -` - lxs = lex(content) - tree, err = ast(lxs) - if err != nil { - t.Fatal(err) - } - c, err = tree.Eval() - if err != nil { - t.Fatal(err) - } - if c != "<p><b><em>bon</em>soir</b></p>" { - t.Errorf("failed, got %s", c) - t.Logf("lxs: %s\ntree: %s", lxs, tree) - } - content = "je suis un `code`" - lxs = lex(content) - tree, err = ast(lxs) - if err != nil { - t.Fatal(err) - } - c, err = tree.Eval() - if err != nil { - t.Fatal(err) - } - if c != "<p>je suis un <code>code</code></p>" { - t.Errorf("failed, got %s", c) - t.Logf("lxs: %s\ntree: %s", lxs, tree) - } - content = ` -> Bonsoir, je suis un **code** -avec une source -` - lxs = lex(content) - tree, err = ast(lxs) - if err != nil { - t.Fatal(err) - } - c, err = tree.Eval() - if err != nil { - t.Fatal(err) - } - if c != `<div class="quote"><blockquote>Bonsoir, je suis un <b>code</b></blockquote><p>avec une source</p></div>` { - t.Errorf("failed, got %s", c) - t.Logf("lxs: %s\ntree: %s", lxs, tree) - } } |
