feat: add unit tests

This commit is contained in:
2025-11-12 19:28:48 +01:00
parent 0eca6d6725
commit 6e9ce92cde
12 changed files with 510 additions and 0 deletions

35
t/06-code.t Executable file
View File

@@ -0,0 +1,35 @@
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More tests => 5;
use MarkdownParser;
my $parser = MarkdownParser->new();
is(
$parser->parse("`inline code`"),
"<p><code>inline code</code></p>\n",
"Inline code"
);
is(
$parser->parse("Text with `code` in it"),
"<p>Text with <code>code</code> in it</p>\n",
"Inline code in text"
);
is(
$parser->parse("```\ncode block\n```"),
"<pre><code>\ncode block\n</code></pre>\n",
"Code block"
);
is(
$parser->parse("```\nline 1\nline 2\nline 3\n```"),
"<pre><code>\nline 1\nline 2\nline 3\n</code></pre>\n",
"Multi-line code block"
);
is(
$parser->parse("```\n```"),
"<pre><code>\n</code></pre>\n",
"Empty code block"
);