Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

54 lines (41 sloc) 1.465 kb
use strict;
use Test::More 'no_plan';
use XML::Atom::Feed;
my $feed = XML::Atom::Feed->new("t/samples/vox.xml");
my $entry = ($feed->entries)[0];
ok $entry;
is $entry->title, "Pirates of Caribbean - Dead Man's Chest";
my @category = $entry->category;
is @category, 4, 'returns list in a list context';
is $category[0]->term, 'disney';
is $category[0]->scheme, '';
is $category[0]->label, 'disney';
my $cat = $entry->category;
isa_ok $cat, 'XML::Atom::Category', 'scalar context';
is $cat->term, 'disney';
my @categories = $entry->categories;
is @categories, 4, "moniker";
my $entry = XML::Atom::Entry->new( Version => 1.0 );
$entry->title("foo bar");
term => "foo",
scheme => "",
label => "foo bar",
my @cat = $entry->categories;
is @cat, 1;
is $cat[0]->term, "foo";
is $cat[0]->scheme, "";
is $cat[0]->label, "foo bar";
term => "bar",
scheme => "",
@cat = $entry->categories;
is @cat, 2;
is $cat[1]->term, "bar";
my $xml = $entry->as_xml;
like $xml, qr!<category(?: xmlns="")? term="foo" scheme="" label="foo bar"/>!;
like $xml, qr!<category(?: xmlns="")? term="bar" scheme=""/>!;
Jump to Line
Something went wrong with that request. Please try again.