]> git.donarmstrong.com Git - liborg-parser-perl.git/blob - t/fixed_width_section.t
Import original source of Org-Parser 0.23
[liborg-parser-perl.git] / t / fixed_width_section.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 => 'non-fixed-width-section (missing space after colon)',
16     filter_elements => 'Org::Element::FixedWidthSection',
17     doc  => <<'_',
18 :foo
19 _
20     num => 0,
21 );
22
23 test_parse(
24     name => 'basic tests',
25     filter_elements => 'Org::Element::FixedWidthSection',
26     doc  => <<'_',
27  :  this is *an* example
28
29    : this is another example
30
31 : yet another
32 :
33 : with empty line
34 _
35     num  => 3,
36     test_after_parse => sub {
37         my %args = @_;
38         my $elems = $args{elements};
39         is($elems->[0]->text, " this is *an* example\n", "#0: text()");
40         is($elems->[1]->text, "this is another example\n", "#1: text()");
41         is($elems->[2]->text, "yet another\n\nwith empty line\n", "#2: text()");
42     },
43 );
44
45 done_testing();