File: lists.t

package info (click to toggle)
libtext-mediawikiformat-perl 1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze, wheezy
  • size: 236 kB
  • ctags: 46
  • sloc: perl: 1,848; makefile: 2
file content (65 lines) | stat: -rw-r--r-- 1,312 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!perl

BEGIN { chdir 't' if -d 't' }

use strict;
use warnings;

use Test::More tests => 8;
use Test::NoWarnings;

use_ok 'Text::MediawikiFormat', as => 'wf', process_html => 0 or exit;
ok exists $Text::MediawikiFormat::tags{blockorder},
   'T:MF should have a blockorder entry in %tags';

# isan ARRAY
isa_ok $Text::MediawikiFormat::tags{blockorder}, 'ARRAY',
       '...and it should be an array';

like join(' ', @{$Text::MediawikiFormat::tags{blockorder}}),
     qr/^code/,
     '...and code should come before everything';

my $wikitext =<<END_HERE;
* first list item
* second list item
* list item with a [[Wiki Link]]
END_HERE

my $htmltext = wf ($wikitext);

like $htmltext, qr!<li>first list item!,
     'lists should be able to start on the first line of text';
like $htmltext, qr!href='Wiki%20Link'!,
     'list item content should be formatted';

###
### Dictionary Lists
###
$wikitext =<<END_HERE;
; Term 1 : definition 1.1
: definition 1.2
; Term 2
: definition 2.1
: definition 2.2

: indented 1
: indented 2
END_HERE

$htmltext = wf ($wikitext);

is $htmltext, '<dl>
<dt>Term 1</dt>
<dd>definition 1.1</dd>
<dd>definition 1.2</dd>
<dt>Term 2</dt>
<dd>definition 2.1</dd>
<dd>definition 2.2</dd>
</dl>
<dl>
<dd>indented 1</dd>
<dd>indented 2</dd>
</dl>
',
   'dictionary lists format correctly';