Debian Codegraph @

t/11-xml-base-atom.t

raw
1 use strict;
2 use warnings;
3 use Test::More tests => 13;
4 use XML::Feed;
5
6
7 my $feed = XML::Feed->parse('t/samples/base_atom.xml');
8 my ($entry) = $feed->entries;
9 my $content = $entry->content;
10 is($feed->base, "http://example.org/", "Got feed base");
11 is($entry->base, "http://example.org/archives/", "Got entry base");
12 is($content->base, "http://example.org/archives/000001.html", "Got content base");
13
14 my $xml = $feed->as_xml;
15 my $new;
16 ok($new = XML::Feed->parse(\$xml), "Parsed old feed");
17 my ($new_entry) = $new->entries;
18 my $new_content = $entry->content;
19 is($new->base, "http://example.org/", "Got feed base");
20 is($new_entry->base, "http://example.org/archives/", "Got entry base");
21 is($new_content->base, "http://example.org/archives/000001.html", "Got content base");
22
23
24 ok($feed->base("http://foo.com/"), "Set feed base");
25 ok($entry->base("http://foo.com/archives/"), "Set entry base");
26 ok($content->base("http://foo.com/archives/000001.html"), "Set content base");
27
28 is($feed->base, "http://foo.com/", "Got feed base");
29 is($entry->base, "http://foo.com/archives/", "Got entry base");
30 is($content->base, "http://foo.com/archives/000001.html", "Got content base");
31