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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
use strict;
use warnings;
use Test::More tests => 7;
use Test::Exception;
use_ok( 'Text::Markdown', 'markdown' );
my $instr = q{A trivial block of text};
my $outstr = q{<p>A trivial block of text</p>};
lives_ok {
$outstr = markdown($instr);
} 'Functional markdown works without an exception';
chomp($outstr);
is(
$outstr => '<p>' . $instr . '</p>',
'exported markdown function works'
);
# Test that we *force* multimarkdown features to be off
$instr = q{# Heading 1};
my $expstr = qq{<h1>Heading 1</h1>\n};
lives_ok {
$outstr = markdown($instr, { heading_ids => 1});
} 'Functional markdown works without an exception, with options';
is(
$outstr => $expstr,
'exported markdown function overrides passed options'
);
{
local $TODO = 'Broken here';
$outstr = '';
lives_ok {
$outstr = Text::Markdown->markdown($instr);
} 'Lives (class method)';
chomp($outstr);
is($outstr, '<p>' . $instr . '</p>', 'Text::Markdown->markdown() works (as class method)');
};
|