~ubuntu-branches/ubuntu/warty/libtext-wikiformat-perl/warty

« back to all changes in this revision

Viewing changes to t/tag-override-use-as.t

  • Committer: Bazaar Package Importer
  • Author(s): Sam Johnston
  • Date: 2004-02-18 17:44:54 UTC
  • Revision ID: james.westby@ubuntu.com-20040218174454-hgevegftws121kgv
Tags: upstream-0.71
ImportĀ upstreamĀ versionĀ 0.71

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl -w
 
2
 
 
3
BEGIN
 
4
{
 
5
        chdir 't' if -d 't';
 
6
        unshift @INC, '../blib/lib';
 
7
}
 
8
 
 
9
use strict;
 
10
use Test::More tests => 2;
 
11
use Text::WikiFormat as => 'wikiformat';
 
12
 
 
13
my $wikitext =<<WIKI;
 
14
 
 
15
    * This should be a list.
 
16
 
 
17
    1. This should be an ordered list.
 
18
 
 
19
* This is like the default unordered list
 
20
* But not indented
 
21
 
 
22
    ! This is like the default unordered list
 
23
    ! But marked differently
 
24
 
 
25
WIKI
 
26
 
 
27
my $indent = $Text::WikiFormat::indent;
 
28
 
 
29
my %format_tags = ( blocks => { unordered => qr/\s*!\s*/ } );
 
30
 
 
31
my $htmltext = wikiformat( $wikitext, \%format_tags, {} );
 
32
like( $htmltext, qr!<li>But marked differently</li>!m,
 
33
        'redefining a list type works with use as' );
 
34
 
 
35
%format_tags = (
 
36
        indent => qr//,
 
37
        blocks => { 
 
38
                ordered         => qr/^\s*([\dA-Za-z]+)\.\s*/, 
 
39
                unordered       => qr/\s*\*\s*/
 
40
        },
 
41
        indented => { unordered => 0 },
 
42
); 
 
43
 
 
44
$htmltext = wikiformat( $wikitext, \%format_tags, {} );
 
45
like( $htmltext, qr!<li>But not indented!m,
 
46
        'redefining a list type to require no indent works with use as' );