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.
47 lines
886 B
47 lines
886 B
#!/usr/bin/env perl |
|
|
|
use strict; |
|
use warnings; |
|
use utf8; |
|
|
|
use Test::More tests => 3; |
|
use Text::Dokuwiki; |
|
|
|
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 |
|
|
|
my $dw = Text::Dokuwiki->new; |
|
isa_ok($dw, 'Text::Dokuwiki'); |
|
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'], |
|
] |
|
]);
|
|
|