Browse Source

+ t/parse-include.t

master
Zubrikhin Alexey 10 years ago
parent
commit
bb65c6d0bd
  1. 31
      t/parse-include.t

31
t/parse-include.t

@ -0,0 +1,31 @@
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use Test::More tests => 8;
use Text::Dokuwiki;
my $dw = Text::Dokuwiki->new;
isa_ok($dw, 'Text::Dokuwiki');
my $elem = $dw->_parse_include('{{image.png}}');
is(ref $elem, 'ARRAY');
is_deeply($elem, [img => {align => 'left', src => 'image.png'}]);
$elem = $dw->_parse_include('{{image.png?100}}');
is_deeply($elem, [img => {align => 'left', src => 'image.png', width => '100'}]);
$elem = $dw->_parse_include('{{ image.png?100x200 }}');
is_deeply($elem, [img => {align => 'center', src => 'image.png', width => '100', height => 200}]);
$elem = $dw->_parse_include('{{ :image.png|image}}');
is_deeply($elem, [img => {align => 'right', src => '/image.png', title => 'image'}]);
$elem = $dw->_parse_include('{{namespace:image.png|}}');
is_deeply($elem, [img => {align => 'left', src => 'namespace/image.png', title => ''}]);
$elem = $dw->_parse_include('{{namespace:image.png|text | 1}}');
is_deeply($elem, [img => {align => 'left', src => 'namespace/image.png', title => 'text | 1'}]);
Loading…
Cancel
Save