]> git.donarmstrong.com Git - liborg-parser-perl.git/blob - t/list.t
Import original source of Org-Parser 0.23
[liborg-parser-perl.git] / t / list.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     parse_file_args => ["t/data/listitem.org"],
16     name => 'list tests',
17     filter_elements => 'Org::Element::ListItem',
18     num => 15,
19     test_after_parse => sub {
20         my (%args) = @_;
21         my $elems = $args{elements};
22
23         my $i=0;
24         is($elems->[$i]->parent->indent, " "x2, "item[$i]->list->indent");
25         is($elems->[$i]->bullet, "-", "item[$i]->bullet");
26         is($elems->[$i]->parent->type, "U", "item[$i]->list->type");
27
28         $i=6;
29         is($elems->[$i]->parent->type, "D", "item[$i]->list->type");
30
31         $i=7;
32         is($elems->[$i]->check_state, "X", "item[$i]->check_state");
33         # TODO: only check_states " ", "X", "-" are valid
34
35         $i=9;
36         is($elems->[$i]->parent->indent, " "x8, "item[$i]->list->indent");
37         is($elems->[$i]->bullet, "1.", "item[$i]->bullet");
38         is($elems->[$i]->parent->type, "O", "item[$i]->list->type");
39
40         # XXX the rest of 1..14
41     },
42 );
43
44 done_testing();