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

30
t/10-html-escape.t Executable file
View File

@@ -0,0 +1,30 @@
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More tests => 4;
use MarkdownParser;
my $parser = MarkdownParser->new();
is(
$parser->parse("Text with <tag>"),
"<p>Text with &lt;tag&gt;</p>\n",
"HTML tags escaped"
);
is(
$parser->parse("Text with & symbol"),
"<p>Text with &amp; symbol</p>\n",
"Ampersand escaped"
);
is(
$parser->parse('Text with "quotes"'),
"<p>Text with &quot;quotes&quot;</p>\n",
"Quotes escaped"
);
is(
$parser->parse("Text with 'apostrophe'"),
"<p>Text with &#39;apostrophe&#39;</p>\n",
"Apostrophe escaped"
);