You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
910 B

10 years ago
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use Test::More tests => 3;
10 years ago
use Text::Dokuwiki::Parser;
10 years ago
my @lines = split /\n/, <<EOF;
* level1 item1
* level1 item2
- level2 item1
- level2 item2
* level2 item3
* level1 item3
- level1 of 2nd list, item1
- level1 of 2nd list, item2
EOF
10 years ago
my $dw = Text::Dokuwiki::Parser->new;
isa_ok($dw, 'Text::Dokuwiki::Parser');
10 years ago
my @lists = $dw->_parse_list([ @lines ]);
is (scalar @lists, 2);
is_deeply(\@lists, [
[ul => {},
[li => {}, 'level1 item1'],
[li => {}, 'level1 item2'],
[li => {},
[ol => {},
[li => {}, 'level2 item1'],
[li => {}, 'level2 item2'],
],
],
[li => {},
[ul => {},
[li => {}, 'level2 item3']
],
],
[li => {}, 'level1 item3'],
],
[ol => {},
[li => {}, 'level1 of 2nd list, item1'],
[li => {}, 'level1 of 2nd list, item2'],
]
]);