aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--design/index.html2
-rw-r--r--mardown/ast_modifier_test.go22
-rw-r--r--mardown/ast_paragraph_test.go20
-rw-r--r--mardown/ast_quote_test.go23
-rw-r--r--mardown/ast_test.go61
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)
- }
}