From: Gabor Szabo Date: Sun, 19 Feb 2012 07:52:00 +0000 (+0200) Subject: add explicit tests for loading internal packages and failing when it does not exist X-Git-Tag: RELEASE_0.48~5^2~4 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e3322e16b59f2f78797522dbc89287162da53b55;hp=8c43fc54b494ebb1ae8b451d18fd77603fe20372;p=catagits%2FXML-Feed.git add explicit tests for loading internal packages and failing when it does not exist --- diff --git a/t/23-eval.t b/t/23-eval.t new file mode 100644 index 0000000..f212a0a --- /dev/null +++ b/t/23-eval.t @@ -0,0 +1,41 @@ +use strict; +use warnings; +use Test::More tests => 8; + +use XML::Feed; +use XML::Feed::Entry; + +eval { + XML::Feed::Entry->new('Nofeed'); +}; +like $@, qr{Unsupported format Nofeed:}, 'Unsupported format'; + +{ + my $rss = XML::Feed::Entry->new('RSS'); + isa_ok $rss, 'XML::Feed::Entry::Format::RSS'; + + my $atom = XML::Feed::Entry->new('Atom'); + isa_ok $atom, 'XML::Feed::Entry::Format::Atom'; + + my $default = XML::Feed::Entry->new(); + isa_ok $default, 'XML::Feed::Entry::Format::Atom'; +} + + +eval { + XML::Feed->new('Nofeed'); +}; +like $@, qr{Unsupported format Nofeed:}, 'Unsupported format'; + +{ + my $rss = XML::Feed->new('RSS'); + isa_ok $rss, 'XML::Feed::Format::RSS'; + + my $atom = XML::Feed->new('Atom'); + isa_ok $atom, 'XML::Feed::Format::Atom'; + + my $default = XML::Feed->new(); + isa_ok $default, 'XML::Feed::Format::Atom'; +} + +