Add support for RFC 5005 Feed Paging and Archiving in Atom feeds
[catagits/XML-Feed.git] / t / 02-create.t
index 776565c..e5fdb18 100644 (file)
@@ -91,6 +91,24 @@ for my $format (qw( Atom RSS )) {
     {
         like ($feed->as_xml(), qr{\Q<link rel="self" href="http://tor.tld/my-feed.rss" type="application/atom+xml"/>\E},
             "Feed contains the atom:link");
+
+        my %rfc5005 = (
+            first_link => "http://tor.tld/my-feed.xml?page=1",
+            next_link  => "http://tor.tld/my-feed.xml?page=4",
+            previous_link  => "http://tor.tld/my-feed.xml?page=2",
+            last_link  => "http://tor.tld/my-feed.xml?page=99",
+            current_link  => "http://tor.tld/archive/2.xml",
+            prev_archive_link  => "http://tor.tld/archive/1.xml",
+            next_archive_link  => "http://tor.tld/archive/3.xml",
+        );
+
+        while ( my($name,$url) = each(%rfc5005) ) {
+            $feed->$name($url);
+            $name =~ s/_link$//;
+            $name =~ s/_/-/g; 
+            like ($feed->as_xml(), qr{\Q<link rel="$name" href="$url" type="application/atom+xml"/>\E},
+                "Feed contains an RFC 5005 rel=\"$name\" link");
+        }
     }
 
 }