Permalink
Browse files

add explicit tests for loading internal packages and failing when it …

…does not exist
  • Loading branch information...
1 parent 8c43fc5 commit e3322e16b59f2f78797522dbc89287162da53b55 @szabgab szabgab committed Feb 19, 2012
Showing with 41 additions and 0 deletions.
  1. +41 −0 t/23-eval.t
View
41 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';
+}
+
+

0 comments on commit e3322e1

Please sign in to comment.