diff options
| author | Anhgelus Morhtuuzh <william@herges.fr> | 2025-12-15 17:38:35 +0100 |
|---|---|---|
| committer | Anhgelus Morhtuuzh <william@herges.fr> | 2025-12-15 17:38:35 +0100 |
| commit | 587f4ff7152dbf82b39f0d9afc61be7a16570686 (patch) | |
| tree | b715ead5e80e98af31d3a1bc3b2d15a5016936c7 /markdown/ast_code_test.go | |
| parent | 3312977ebeff03edc5b1bc1a2f815cad6a1ba7b8 (diff) | |
fix(markdown): adding linebreak at the beginning in multiline code block
create tests for code
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) + } +} |
