Punk-Feed

 view release on metacpan or  search on metacpan

t/10-atom.t  view on Meta::CPAN

sub atom { Punk::Plugin::Feed::_doc($_[0], $_[1], 'atom') }

my @ONE = ({ loc => '/p/1', title => 'First', updated => '2019-03-04T05:06:07Z' });

# ---- the document's frame --------------------------------------------------

{
    my $d = atom(app(\@ONE));

    is(index($d, '<?xml version="1.0" encoding="UTF-8"?>'), 0,
        'the prolog is the very first bytes - a BOM or a leading newline '
      . 'makes the document invalid');
    like($d, qr{<feed xmlns="http://www\.w3\.org/2005/Atom">},
        'the Atom namespace');
    like($d, qr{</feed>\s*\z}, 'and it closes');

    # everything Atom makes mandatory, at the feed level
    like($d, qr{<id>https://example\.com/feed\.xml</id>}, 'a feed id');
    like($d, qr{<title>Example</title>},                  'a feed title');
    like($d, qr{<updated>2019-03-04T05:06:07Z</updated>}, 'a feed updated');



( run in 3.326 seconds using v1.01-cache-2.11-cpan-8dfa8b56332 )