8 eval q{use Test::More skip_all => "XML::Feed not available"};
11 eval q{use Test::More tests => 72};
16 my $baseurl = 'http://example.com';
17 my @command = (qw(./ikiwiki.out -plugin inline -rss -atom));
18 push @command, qw(-underlaydir=underlays/basewiki);
19 push @command, qw(-set underlaydirbase=underlays -templatedir=templates);
20 push @command, "-url=$baseurl", qw(t/tinypodcast t/tmp/out);
22 ok(! system("mkdir t/tmp"));
23 ok(! system(@command));
27 'piano.mp3' => 'audio/mpeg',
28 'scroll.3gp' => 'video/3gpp',
29 'walter.ogg' => 'video/x-theora+ogg',
32 for my $format (qw(atom rss)) {
33 my $feed = XML::Feed->parse("t/tmp/out/index.$format");
35 is($feed->title, 'wiki',
36 qq{$format feed title});
37 is($feed->link, "$baseurl/",
38 qq{$format feed link});
39 is($feed->description, $feed->title,
40 qq{$format feed description});
41 if ('atom' eq $format) {
42 is($feed->author, $feed->title,
43 qq{$format feed author});
44 is($feed->id, "$baseurl/",
46 is($feed->generator, "ikiwiki",
47 qq{$format feed generator});
50 for my $entry ($feed->entries) {
51 my $title = $entry->title;
53 my $body = $entry->content->body;
54 my $enclosure = $entry->enclosure;
56 is($entry->link, $url, qq{$format $title link});
57 isnt($entry->issued, undef,
58 qq{$format $title issued date});
59 isnt($entry->modified, undef,
60 qq{$format $title modified date});
62 if (defined $media_types{$title}) {
63 is($url, "$baseurl/$title",
64 qq{$format $title id});
66 qq{$format $title no body text});
67 is($enclosure->url, $url,
68 qq{$format $title enclosure url});
69 is($enclosure->type, $media_types{$title},
70 qq{$format $title enclosure type});
71 cmp_ok($enclosure->length, '>', 0,
72 qq{$format $title enclosure length});
75 is($url, "$baseurl/$title/",
76 qq{$format $title id});
78 qq{$format $title body text});
80 qq{$format $title no enclosure});
85 ok(! system("rm -rf t/tmp t/tinypodcast/.ikiwiki"));