File: 04_parser.t

package info (click to toggle)
libcommonmark-perl 0.310100-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 220 kB
  • sloc: perl: 291; makefile: 3
file content (29 lines) | stat: -rw-r--r-- 558 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use strict;
use warnings;

use Test::More tests => 4;

BEGIN {
    use_ok('CommonMark');
}

my $parser = CommonMark::Parser->new;
isa_ok($parser, 'CommonMark::Parser', 'Parser->new');

$parser->feed("normal *em");
$parser->feed("ph*\n\n**strong**\n\n> blo");
$parser->feed("ck\n> quote\n");

my $doc = $parser->finish;
isa_ok($doc, 'CommonMark::Node', 'finish');

my $expected_html = <<'EOF';
<p>normal <em>emph</em></p>
<p><strong>strong</strong></p>
<blockquote>
<p>block
quote</p>
</blockquote>
EOF
is($doc->render_html, $expected_html, 'parser works');