diff options
Diffstat (limited to 'markdown/ast_code_test.go')
| -rw-r--r-- | markdown/ast_code_test.go | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/markdown/ast_code_test.go b/markdown/ast_code_test.go new file mode 100644 index 0000000..b116544 --- /dev/null +++ b/markdown/ast_code_test.go @@ -0,0 +1,33 @@ +package markdown + +import "testing" + +func TestCode(t *testing.T) { + got, err := Parse("`mono`", nil) + if err != nil { + t.Fatal(err) + } + if string(got) != `<p><code>mono</code></p>` { + t.Errorf("invalid value, got %s", got) + } + + got, err = Parse("bonjour `code` !", nil) + if err != nil { + t.Fatal(err) + } + if string(got) != `<p>bonjour <code>code</code> !</p>` { + t.Errorf("invalid value, got %s", got) + } + + got, err = Parse( + "```\n"+"raw\nhehe"+"```", + nil, + ) + if err != nil { + t.Fatal(err) + } + if string(got) != `<pre><code>raw +hehe</code></pre>` { + t.Errorf("invalid value, got %s", got) + } +} |
