File: 18-double2.t

package info (click to toggle)
libxml-feed-perl 0.65%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 508 kB
  • sloc: perl: 1,162; xml: 682; makefile: 4
file content (74 lines) | stat: -rw-r--r-- 1,630 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
use strict;
use warnings;

use Test::More tests => 14;

use XML::Feed;
use File::Spec;


{
    my $rss = XML::Feed->parse(
        File::Spec->catfile(File::Spec->curdir(),
            "t", "samples", "rss20-double.xml"
        )
    );

    # TEST
    isa_ok($rss, 'XML::Feed::Format::RSS');
    my $rss_entry = ($rss->entries)[0];

    # TEST
    isa_ok($rss_entry, 'XML::Feed::Entry::Format::RSS');


    my $rss_content = $rss_entry->content;

    # TEST
    isa_ok($rss_content, 'XML::Feed::Content');

    # TEST
    is($rss_content->type, 'text/html', 'Correct content type');

    # TEST
    like($rss_content->body, qr(<|&lt;), 'Contains HTML tags');

    # TEST
    like($rss_content->body,
         qr{\Q<a href="http://search.cpan.org/perldoc?Dancer">Dancer</a>},
         'Contains HTML tags');

    unlike($rss->as_xml, qr{&amp;lt;}, 'No double encoding');

    my $atom = $rss->convert('Atom');

    # TEST
    isa_ok($atom, 'XML::Feed::Format::Atom');

    my $atom_entry = ($atom->entries)[0];

    # TEST
    isa_ok($atom_entry, 'XML::Feed::Entry::Format::Atom');

    my $atom_content = $atom_entry->content;

    # TEST
    isa_ok($atom_content, 'XML::Feed::Content');

    # TEST
    TODO: {
        local $TODO = 'Needs more investigation';
        is($atom_content->type, 'text/html', 'Correct content type');
    }

    # TEST
    like($atom_content->body, qr(<|&lt;), 'Contains HTML tags');

    # TEST
    like($atom_content->body,
        qr{\Q<a href="http://search.cpan.org/perldoc?Dancer">Dancer</a>},
        'Contains HTML tags');

    unlike($atom->as_xml, qr{&amp;lt;}, 'No double encoding');
}