| 1 |
use strict; |
| 2 |
use Test::More tests => 6; |
| 3 |
use XML::Feed; |
| 4 |
|
| 5 |
$field ||= "categories"; |
| 6 |
ok(my $feed = XML::Feed->parse("t/samples/${type}-multiple-${field}.xml"), "Parsed $type file with multiple categories"); |
| 7 |
my ($entry) = $feed->entries; |
| 8 |
|
| 9 |
is_deeply( |
| 10 |
[$entry->category()], |
| 11 |
["foo", "bar", "quux", "simon's tags"], |
| 12 |
"Got all categories"); |
| 13 |
|
| 14 |
my $xml = $feed->as_xml; |
| 15 |
ok($feed = XML::Feed->parse(\$xml), "Reparsed $type from string"); |
| 16 |
is_deeply( |
| 17 |
[$entry->category()], |
| 18 |
["foo", "bar", "quux", "simon's tags"], |
| 19 |
"Got all categories again"); |
| 20 |
|
| 21 |
ok($entry->category("quirka fleeg"), "Added a category"); |
| 22 |
is_deeply( |
| 23 |
[$entry->category()], |
| 24 |
["foo", "bar", "quux", "simon's tags", "quirka fleeg"], |
| 25 |
"Got new category"); |
| 26 |
|