#!perl -w use strict; use Data::Microformat::hFeed; use DateTime; use Test::More tests => 18; my $simple = << 'EOF'; A bogus title
A feed title
A test feed
A description of a test feed

A title

Brendan did something
Brendan waxed lyrical about cats & puppies.

Updated: November 11,08

Categories: feed tag, some category

Written by:

Brendan O'Connor

cc by 2.0

EOF ok(my $feed = Data::Microformat::hFeed->parse($simple), "Parsed feed"); my $issued = DateTime->new( year => 2008, month => 11, day => 4, hour => 17, minute => 21, second => 6); my $modified = $issued->clone->add(seconds => 1); is($feed->title, "A feed title", "Got correct title"); is($feed->tagline, "A test feed", "Got correct tag line"); is($feed->description, "A description of a test feed", "Got correct tag line"); is("".$feed->modified, "".$issued, "Got correct feed modification time"); is_deeply([$feed->categories], ['feed tag', 'some category'], "Got feed categories"); ok(my $c = $feed->copyright, "Got feed copyright"); is($c->{text}, "cc by 2.0", "Got correct copyright text"); is($c->{href}, "http://creativecommons.org/licenses/by/2.0/", "Got correct copyright href"); ok(my $author = $feed->author, "Got author"); is($author->fn, "Brendan O'Connor", "Got author fullname"); ok(my ($entry) = $feed->entries, "Got entries"); is($entry->link, "http://example.com/989691066", "Got correct link"); is($entry->summary, "Brendan did something", "Got correct summary"); is($entry->content, "Brendan waxed lyrical about cats & puppies.", "Got correct content"); is("".$entry->issued, "".$issued, "Got correct issued"); is("".$entry->modified, "".$modified, "Got correct modified"); is_deeply([$entry->tags], [qw(microformats perl)], "Got correct tags");