~ubuntu-branches/ubuntu/vivid/libwiki-toolkit-formatter-usemod-perl/vivid

« back to all changes in this revision

Viewing changes to t/node-suffix.t

  • Committer: Bazaar Package Importer
  • Author(s): Dominic Hargreaves
  • Date: 2006-10-20 11:36:52 UTC
  • Revision ID: james.westby@ubuntu.com-20061020113652-9rs9i0ii0if52qff
Tags: upstream-0.20
ImportĀ upstreamĀ versionĀ 0.20

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
use strict;
 
2
use Test::More tests => 2;
 
3
use Wiki::Toolkit::Formatter::UseMod;
 
4
use Test::MockObject;
 
5
 
 
6
my $wikitext = <<WIKITEXT;
 
7
 
 
8
ExistingNode
 
9
 
 
10
NonExistentNode
 
11
 
 
12
WIKITEXT
 
13
 
 
14
my $wiki = Test::MockObject->new;
 
15
$wiki->mock( "node_exists",
 
16
             sub {
 
17
                 my ($self, $node) = @_;
 
18
                 return $node eq "ExistingNode" ? 1 : 0;
 
19
             } );
 
20
 
 
21
my $formatter = Wiki::Toolkit::Formatter::UseMod->new(
 
22
    node_prefix => "/wiki/",
 
23
    node_suffix => ".html",
 
24
    edit_prefix => "/wiki/edit/",
 
25
    edit_suffix => ".html",
 
26
);
 
27
 
 
28
my $html = $formatter->format( $wikitext, $wiki );
 
29
 
 
30
like( $html, qr|<a href="/wiki/ExistingNode.html">ExistingNode</a>|,
 
31
      "node_suffix works" );
 
32
like( $html, qr|<a href="/wiki/edit/NonExistentNode.html">|,
 
33
      "edit_suffix works" );