]> git.donarmstrong.com Git - liborg-parser-perl.git/blob - t/comment.t
Import original source of Org-Parser 0.23
[liborg-parser-perl.git] / t / comment.t
1 #!perl
2
3 use 5.010;
4 use strict;
5 use warnings;
6
7 use FindBin '$Bin';
8 use lib $Bin, "$Bin/t";
9
10 use Org::Parser;
11 use Test::More 0.96;
12 require "testlib.pl";
13
14 test_parse(
15     name => 'comment basic tests',
16     filter_elements => 'Org::Element::Comment',
17     doc  => <<'_',
18 # single line comment
19
20 # *multi*
21 #line
22 # comment
23 #
24
25  # not comment (not started on line 1)
26 _
27     num => 2,
28     test_after_parse => sub {
29         my %args  = @_;
30         my $doc   = $args{result};
31         my $elems = $args{elements};
32         #diag(explain [map {$_->as_string} @$elems]);
33         is( $elems->[0]->as_string, "# single line comment\n",
34            "comment[0] content");
35         is( $elems->[1]->as_string, "# *multi*\n#line\n# comment\n#\n",
36            "comment[1] content");
37         ok(!$elems->[1]->children,
38            "markup not parsed in comment");
39     },
40 );
41
42 done_testing();
43