File: implicit.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 (29 lines) | stat: -rw-r--r-- 765 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
#!perl

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

use strict;
use warnings;

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

use Text::MediawikiFormat as => 'wf', prefix => 'rootdir/wiki.pl?page=',
			  process_html => 0;

my $wikitext =<<WIKI;
StudlyCaps

WIKI

my $htmltext = wf ($wikitext);
unlike $htmltext, qr!<a href='rootdir/wiki\.pl\?page=StudlyCaps'>!m,
       'should create links from StudlyCaps if implicit_links is left alone';

$htmltext = wf ($wikitext, {}, {implicit_links => 0});
unlike ($htmltext, qr!<a href='rootdir/wiki\.pl\?page=StudlyCaps'>!m,
	'...and if implicit_links set to 0');

$htmltext = wf ($wikitext, {}, {implicit_links => 1});
like ($htmltext, qr!<a href='rootdir/wiki\.pl\?page=StudlyCaps'>!m,
      '...and if implicit_links set to 0');