| 1 |
use strict; |
| 2 |
use warnings; |
| 3 |
|
| 4 |
use Test::More tests => 14; |
| 5 |
|
| 6 |
use XML::Feed; |
| 7 |
use File::Spec; |
| 8 |
|
| 9 |
|
| 10 |
{ |
| 11 |
my $rss = XML::Feed->parse( |
| 12 |
File::Spec->catfile(File::Spec->curdir(), |
| 13 |
"t", "samples", "rss20-double.xml" |
| 14 |
) |
| 15 |
); |
| 16 |
|
| 17 |
# TEST |
| 18 |
isa_ok($rss, 'XML::Feed::Format::RSS'); |
| 19 |
my $rss_entry = ($rss->entries)[0]; |
| 20 |
|
| 21 |
# TEST |
| 22 |
isa_ok($rss_entry, 'XML::Feed::Entry::Format::RSS'); |
| 23 |
|
| 24 |
|
| 25 |
my $rss_content = $rss_entry->content; |
| 26 |
|
| 27 |
# TEST |
| 28 |
isa_ok($rss_content, 'XML::Feed::Content'); |
| 29 |
|
| 30 |
# TEST |
| 31 |
is($rss_content->type, 'text/html', 'Correct content type'); |
| 32 |
|
| 33 |
# TEST |
| 34 |
like($rss_content->body, qr(<|<), 'Contains HTML tags'); |
| 35 |
|
| 36 |
# TEST |
| 37 |
like($rss_content->body, |
| 38 |
qr{\Q<a href="http://search.cpan.org/perldoc?Dancer">Dancer</a>}, |
| 39 |
'Contains HTML tags'); |
| 40 |
|
| 41 |
unlike($rss->as_xml, qr{&lt;}, 'No double encoding'); |
| 42 |
|
| 43 |
my $atom = $rss->convert('Atom'); |
| 44 |
|
| 45 |
# TEST |
| 46 |
isa_ok($atom, 'XML::Feed::Format::Atom'); |
| 47 |
|
| 48 |
my $atom_entry = ($atom->entries)[0]; |
| 49 |
|
| 50 |
# TEST |
| 51 |
isa_ok($atom_entry, 'XML::Feed::Entry::Format::Atom'); |
| 52 |
|
| 53 |
my $atom_content = $atom_entry->content; |
| 54 |
|
| 55 |
# TEST |
| 56 |
isa_ok($atom_content, 'XML::Feed::Content'); |
| 57 |
|
| 58 |
# TEST |
| 59 |
TODO: { |
| 60 |
local $TODO = 'Needs more investigation'; |
| 61 |
is($atom_content->type, 'text/html', 'Correct content type'); |
| 62 |
} |
| 63 |
|
| 64 |
# TEST |
| 65 |
like($atom_content->body, qr(<|<), 'Contains HTML tags'); |
| 66 |
|
| 67 |
# TEST |
| 68 |
like($atom_content->body, |
| 69 |
qr{\Q<a href="http://search.cpan.org/perldoc?Dancer">Dancer</a>}, |
| 70 |
'Contains HTML tags'); |
| 71 |
|
| 72 |
unlike($atom->as_xml, qr{&lt;}, 'No double encoding'); |
| 73 |
} |
| 74 |
|