Commit | Line | Data |
3353d70c |
1 | # $Id$ |
5383a560 |
2 | |
3 | use strict; |
e3b96b9c |
4 | use Test::More; |
5383a560 |
5 | use XML::Feed; |
e3b96b9c |
6 | use XML::RSS; |
5383a560 |
7 | |
f62087b4 |
8 | plan tests => 13; |
5383a560 |
9 | |
10 | my $feed = XML::Feed->parse('t/samples/base_rss.xml'); |
e3b96b9c |
11 | |
5383a560 |
12 | my ($entry) = $feed->entries; |
13 | my $content = $entry->content; |
7c89ffff |
14 | is($feed->base, "http://example.org/", "Got feed base"); |
15 | is($entry->base, "http://example.org/archives/", "Got entry base"); |
16 | is($content->base, "http://example.org/archives/000001.html", "Got content base"); |
17 | |
18 | my $xml = $feed->as_xml; |
19 | my $new; |
20 | ok($new = XML::Feed->parse(\$xml), "Parsed old feed"); |
21 | my ($new_entry) = $new->entries; |
22 | my $new_content = $entry->content; |
23 | is($new->base, "http://example.org/", "Got feed base"); |
24 | is($new_entry->base, "http://example.org/archives/", "Got entry base"); |
25 | is($new_content->base, "http://example.org/archives/000001.html", "Got content base"); |
26 | |
27 | |
28 | ok($feed->base("http://foo.com/"), "Set feed base"); |
29 | ok($entry->base("http://foo.com/archives/"), "Set entry base"); |
30 | ok($content->base("http://foo.com/archives/000001.html"), "Set content base"); |
31 | |
32 | is($feed->base, "http://foo.com/", "Got feed base"); |
33 | is($entry->base, "http://foo.com/archives/", "Got entry base"); |
34 | is($content->base, "http://foo.com/archives/000001.html", "Got content base"); |
35 | |
36 | |