Eliminate `undef` warnings. #19

Open
wants to merge 2 commits into
from
View
@@ -19,6 +19,7 @@ test_requires 'Test::More' => '0.42';
test_requires 'Test::Exception' => undef;
test_requires 'List::MoreUtils' => undef;
test_requires 'Test::Differences' => undef;
+test_requires 'Test::NoWarnings' => undef;
test_requires 'FindBin' => undef;
if ($Module::Install::AUTHOR) {
View
@@ -266,6 +266,9 @@ sub urls {
sub _CleanUpDoc {
my ($self, $text) = @_;
+ # An empty file can end up getting passed as undef.
+ return "\n\n" unless defined $text;
+
# Standardize line endings:
$text =~ s{\r\n}{\n}g; # DOS to Unix
$text =~ s{\r}{\n}g; # Mac to Unix
View
@@ -0,0 +1,9 @@
+use strict;
+use warnings;
+use Test::More tests => 3;
+use Text::Markdown;
+use Test::NoWarnings;
+
+my $m = Text::Markdown->new;
+ok $m->markdown(''), 'Parse empty string';
+ok $m->markdown(undef), 'Parse undef';