Debian Codegraph @

t/implicit.t

raw
1 #!perl
2
3 BEGIN { chdir 't' if -d 't' }
4
5 use strict;
6 use warnings;
7
8 use Test::More tests => 4;
9 use Test::NoWarnings;
10
11 use Text::MediawikiFormat
12 as => 'wf',
13 prefix => 'rootdir/wiki.pl?page=',
14 process_html => 0;
15
16 my $wikitext = <<WIKI;
17 StudlyCaps
18
19 WIKI
20
21 my $htmltext = wf($wikitext);
22 unlike $htmltext, qr!<a href='rootdir/wiki\.pl\?page=StudlyCaps'>!m,
23 'should create links from StudlyCaps if implicit_links is left alone';
24
25 $htmltext = wf( $wikitext, {}, { implicit_links => 0 } );
26 unlike( $htmltext, qr!<a href='rootdir/wiki\.pl\?page=StudlyCaps'>!m, '...and if implicit_links set to 0' );
27
28 $htmltext = wf( $wikitext, {}, { implicit_links => 1 } );
29 like( $htmltext, qr!<a href='rootdir/wiki\.pl\?page=StudlyCaps'>!m, '...and if implicit_links set to 0' );