File: 11-xml-base-rss.t

package info (click to toggle)
libxml-feed-perl 0.65%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 508 kB
  • sloc: perl: 1,162; xml: 682; makefile: 4
file content (35 lines) | stat: -rw-r--r-- 1,431 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use strict;
use warnings;
use Test::More;
use XML::Feed;
use XML::RSS;

plan tests => 13;

my $feed    = XML::Feed->parse('t/samples/base_rss.xml');

my ($entry) = $feed->entries;
my $content = $entry->content;
is($feed->base,    "http://example.org/",                         "Got feed base");
is($entry->base,   "http://example.org/archives/",                "Got entry base");
is($content->base, "http://example.org/archives/000001.html",     "Got content base");

my $xml = $feed->as_xml;
my $new;
ok($new =  XML::Feed->parse(\$xml),                               "Parsed old feed");
my ($new_entry)  = $new->entries;
my $new_content  = $entry->content;
is($new->base,         "http://example.org/",                     "Got feed base");
is($new_entry->base,   "http://example.org/archives/",            "Got entry base");
is($new_content->base, "http://example.org/archives/000001.html", "Got content base");


ok($feed->base("http://foo.com/"),                                "Set feed base");
ok($entry->base("http://foo.com/archives/"),                      "Set entry base");
ok($content->base("http://foo.com/archives/000001.html"),         "Set content base");

is($feed->base,    "http://foo.com/",                             "Got feed base");
is($entry->base,   "http://foo.com/archives/",                    "Got entry base");
is($content->base, "http://foo.com/archives/000001.html",         "Got content base");