Added new tests to prove what the problem is.
[catagits/XML-Feed.git] / t / 18-double2.t
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(<|&lt;), 'Contains HTML tags');
35
36     # TEST
37     like($rss_content->body, 
38          qr{\A\Q<div class='snap_preview'><br /><p style="text-align:justify;"><span style="color:#000000;">In an interesting, not to say quixotic},
39          'Contains HTML tags');
40
41     unlike($rss->as_xml, qr{&amp;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     is($atom_content->type, 'text/html', 'Correct content type');
60
61     # TEST
62     like($atom_content->body, qr(<|&lt;), 'Contains HTML tags');
63
64     # TEST
65     like($atom_content->body, 
66         qr{\A\Q&lt;div class=&#39;snap_preview&#39;&gt;&lt;br /&gt;&lt;p style=&quot;text-align:justify;&quot;&gt;&lt;span style=&quot;color:#000000;&quot;&gt;In an interesting, not to say quixotic},
67         'Contains HTML tags');
68
69     unlike($atom->as_xml, qr{&amp;lt;}, 'No double encoding');
70 }
71