File: CaptureEvents.t

package info (click to toggle)
libmarkdent-perl 0.40-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,368 kB
  • sloc: perl: 5,225; sh: 24; makefile: 13
file content (35 lines) | stat: -rw-r--r-- 849 bytes parent folder | download | duplicates (3)
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
30
31
32
33
34
35
use strict;
use warnings;

use FindBin qw( $Bin );
use lib "$Bin/../../t/lib";

use File::Slurper qw( read_text );
use Markdent::Handler::CaptureEvents;
use Markdent::Handler::MinimalTree;
use Markdent::Parser;
use Test2::V0;
use Test::Markdent;

my $markdown
    = read_text(
    "$Bin/../../t/mdtest-data/Markdown Documentation - Basics.text");

my $ch  = Markdent::Handler::CaptureEvents->new();
my $th1 = Markdent::Handler::MinimalTree->new();

for my $handler ( $ch, $th1 ) {
    my $parser = Markdent::Parser->new( handler => $handler );
    $parser->parse( markdown => $markdown );
}

my $th2 = Markdent::Handler::MinimalTree->new();
$ch->captured_events()->replay_events($th2);

is(
    tree_from_handler($th1),
    tree_from_handler($th2),
    'compare parse direct to tree versus replaying captured events into a tree'
);

done_testing();