File: 12-multi-categories.base

package info (click to toggle)
libxml-feed-perl 0.63%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 508 kB
  • sloc: perl: 1,158; xml: 682; makefile: 4
file content (26 lines) | stat: -rw-r--r-- 742 bytes parent folder | download | duplicates (4)
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
use strict;
use Test::More tests => 6;
use XML::Feed;

$field ||= "categories";
ok(my $feed = XML::Feed->parse("t/samples/${type}-multiple-${field}.xml"), "Parsed $type file with multiple categories");
my ($entry) = $feed->entries;

is_deeply(
        [$entry->category()],
        ["foo", "bar", "quux", "simon's tags"],
"Got all categories");

my $xml = $feed->as_xml;
ok($feed = XML::Feed->parse(\$xml), "Reparsed $type from string");
is_deeply(
        [$entry->category()],
        ["foo", "bar", "quux", "simon's tags"],
"Got all categories again");

ok($entry->category("quirka fleeg"), "Added a category");
is_deeply(
        [$entry->category()],
        ["foo", "bar", "quux", "simon's tags", "quirka fleeg"],
"Got new category");