File: 10-mix-and-match.t

package info (click to toggle)
libxml-feed-perl 0.43%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 308 kB
  • ctags: 105
  • sloc: perl: 924; xml: 450; sh: 22; makefile: 16
file content (32 lines) | stat: -rw-r--r-- 843 bytes parent folder | download
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
# $Id: 10-mix-and-match.t 115 2008-12-01 21:17:51Z swistow $

use strict;
use Test::More tests => 6;
use XML::Feed;


my $afeed  = XML::Feed->new('Atom');
my $rfeed  = XML::Feed->new('RSS');
my $atom   = make_entry('Atom');
my $rss    = make_entry('RSS');


ok($afeed->add_entry($atom), "Added Atom entry to Atom feed");
ok($afeed->add_entry($rss),  "Added RSS  entry to Atom feed");

ok($rfeed->add_entry($rss),  "Added RSS  entry to RSS feed");
ok($rfeed->add_entry($atom), "Added Atom entry to RSS feed");



is(scalar $afeed->entries, 2, 'Now 2 entries in Atom feed');
is(scalar $rfeed->entries, 2, 'Now 2 entries in RSS  feed');

sub make_entry {
    my $format = shift;
    my $entry  = XML::Feed::Entry->new($format);
    $entry->title("Test Title ".rand());
    $entry->content("Foo");
    $entry->summary("Bar");
    return $entry;
}