#!/usr/bin/perl
use Test::More tests => 8;
BEGIN {
use_ok( 'XML::RSS::Feed', 'loaded XML::RSS::Feed' );
use_ok( 'XML::RSS::Headline', 'loaded XML::RSS::Headline' );
}
my $feed = XML::RSS::Feed->new (
url => "http://www.jbisbee.com/rdf/",
name => 'jbisbee',
);
isa_ok ($feed, 'XML::RSS::Feed');
my $headline = XML::RSS::Headline->new(
url => "http://www.jbisbee.com/testurl/1",
headline => "Test Headline",
);
isa_ok ($headline, 'XML::RSS::Headline');
my $slashdot_rss1 = qq|
Slashdot
http://slashdot.org/
News for nerds, stuff that mattersSlashdothttp://images.slashdot.org/topics/topicslashdot.gif
http://slashdot.org/
XPde 0.5 - A Linux Desktop for Windows Users
http://slashdot.org/article.pl?sid=04/04/03/2322233
Canadian Minister Promises to Fix Copyright Law
http://slashdot.org/article.pl?sid=04/04/03/2317226
Grand Challenge Videos Posted
http://slashdot.org/article.pl?sid=04/04/03/2115226
Make Your Own TRON Costume
http://slashdot.org/article.pl?sid=04/04/03/1722215
Gates on Winsecurity
http://slashdot.org/article.pl?sid=04/04/03/2112235
Automobiles Evolve to Live Up to Their Name
http://slashdot.org/article.pl?sid=04/04/03/2056208
Red Hat Recap
http://slashdot.org/article.pl?sid=04/04/03/2047250
ICANN Cracks Down on Invalid WHOIS Data
http://slashdot.org/article.pl?sid=04/04/03/1726226
Little Robots Play Soccer
http://slashdot.org/article.pl?sid=04/04/03/1724217
NASA Gravity Probe Set for Launch
http://slashdot.org/article.pl?sid=04/04/03/1716234
Search SlashdotSearch Slashdot storiesquery
http://slashdot.org/search.pl
|;
my $slashdot_rss2 = qq|
Slashdot
http://slashdot.org/
News for nerds, stuff that mattersSlashdothttp://images.slashdot.org/topics/topicslashdot.gif
http://slashdot.org/
States Link Databases to Find Tax Cheats
http://slashdot.org/article.pl?sid=04/04/04/2021256
Invulnerable, Waterproof PDA
http://slashdot.org/article.pl?sid=04/04/04/1814258
Still More on Open Source Usability
http://slashdot.org/article.pl?sid=04/04/04/1811226
Moore's Law Limits Pushed Back Again
http://slashdot.org/article.pl?sid=04/04/04/182224
Advanced Mobile Phone Tech in Japan
http://slashdot.org/article.pl?sid=04/04/04/1754231
Computerized Time Clocks Susceptible to 'Manager Attack'
http://slashdot.org/article.pl?sid=04/04/04/1655231
A Completely Separate Ecosystem on Earth
http://slashdot.org/article.pl?sid=04/04/04/1653233
3D, FPS File Manager
http://slashdot.org/article.pl?sid=04/04/04/1621251
Searching by Shape...
http://slashdot.org/article.pl?sid=04/04/04/1423210
New Wave of Web Ads?
http://slashdot.org/article.pl?sid=04/04/04/1410251
Search SlashdotSearch Slashdot storiesquery
http://slashdot.org/search.pl
|;
$feed->parse($slashdot_rss1);
cmp_ok($feed->num_headlines, '==', 10, "Verify 10 Slashdot headlines");
cmp_ok($feed->late_breaking_news, '==', 0, "Verify 0 new headlines");
$feed->parse($slashdot_rss2);
cmp_ok($feed->num_headlines, '==', 20, "Verify 20 Slashdot headlines");
cmp_ok($feed->late_breaking_news, '==', 10, "Verify 10 new headlines");