~ubuntu-branches/ubuntu/trusty/libtext-markdown-perl/trusty

« back to all changes in this revision

Viewing changes to t/06wiki.t

  • Committer: Bazaar Package Importer
  • Author(s): gregor herrmann
  • Date: 2008-04-26 00:35:34 UTC
  • Revision ID: james.westby@ubuntu.com-20080426003534-oo979u4lubd1ltc1
Tags: upstream-1.0.19
ImportĀ upstreamĀ versionĀ 1.0.19

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
use strict;
 
2
use warnings;
 
3
use Test::More tests => 9;
 
4
 
 
5
use_ok( 'Text::MultiMarkdown', 'markdown' );
 
6
 
 
7
my $page = 'WikiWord';
 
8
 
 
9
# FIXME - test 
 
10
#   . No wiki links in headers?
 
11
#   . No wiki links in code section
 
12
 
 
13
# Normal (no wiki links)
 
14
my $m     = Text::MultiMarkdown->new;
 
15
 
 
16
my $nohtmlwiki = $m->markdown($page);
 
17
ok($nohtmlwiki !~ /<a/, 'No link where no htmlwiki');
 
18
 
 
19
# Note - we adding metadata ends up with the output page having that metadata inside it..
 
20
#        therefore we strip the output to the first line containing /WikiWord/ here..
 
21
my $htmlwiki = (grep /WikiWord/, split(/\n/, $m->markdown("use wikilinks: true\n\n" . $page)))[0] . "\n";
 
22
ok($htmlwiki =~ /<a/, 'has a link where expected');
 
23
 
 
24
is($m->markdown($page), $nohtmlwiki, 'use wikilinks does not toggle pref');
 
25
 
 
26
is($m->markdown($page, { use_wikilinks => 1 }) => $htmlwiki, 
 
27
    'use_wikilinks pref in ->markdown produces same out as metadata');
 
28
 
 
29
is($m->markdown($page, { use_wikilinks => 0 }) => $nohtmlwiki,
 
30
    'use_wikilinks = 0 pref in ->markdown produces same out as no metadata');
 
31
 
 
32
$m = Text::MultiMarkdown->new(use_wikilinks => 1);
 
33
is($m->markdown($page) => $htmlwiki, 
 
34
    'use wikiwords pref in constructor produces same out as metadata');
 
35
is($m->markdown($page, { use_wikilinks => 0 }) => $nohtmlwiki, 
 
36
    'not use wikilinks pref in markdown produces same out as no metadata when instance has wikilinks enabled');
 
37
 
 
38
is($m->markdown('\\' . $page) => $nohtmlwiki,
 
39
    'Wiki word escaping works as expected');
 
 
b'\\ No newline at end of file'