/tags/3.1/t/43_expandtemplates.t

http://perlwikipedia.googlecode.com/ · Raku · 24 lines · 12 code · 8 blank · 4 comment · 0 complexity · 3eaf226da457bb9972010bb76cf36d42 MD5 · raw file

  1. # Before `make install' is performed this script should be runnable with
  2. # `make test'. After `make install' it should work as `perl MediaWiki::Bot.t'
  3. #########################
  4. use strict;
  5. use warnings;
  6. use Test::More tests => 2;
  7. #########################
  8. use MediaWiki::Bot;
  9. my $bot = MediaWiki::Bot->new({
  10. agent => 'MediaWiki::Bot tests (43_expandtemplates.t)',
  11. });
  12. my $text = '<tt><nowiki>{{</nowiki>[[Template:tlx|tlx]]<nowiki>}}</nowiki></tt>';
  13. is($bot->expandtemplates(undef, '{{tlx|tlx}}'), $text, '[[Template:Tlx]] expanded OK');
  14. my $main_page = $bot->get_text('Main Page');
  15. my $expanded = $bot->expandtemplates('Main Page');
  16. isnt($main_page, $expanded, 'Wikitext != expanded text');