/[XML-Feed]/t/07-atom10-create.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /t/07-atom10-create.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (hide annotations)
Sun Mar 16 19:47:49 2008 UTC (16 years, 1 month ago) by dpavlin
File MIME type: application/x-troff
File size: 1024 byte(s)
import XML::Feed 0.12 from CPAN

1 dpavlin 1 use strict;
2     use Test::More;
3    
4     plan 'no_plan';
5    
6     use XML::Feed;
7    
8     my $feed = XML::Feed->new('Atom');
9     $feed->title("foo");
10     $feed->description("Atom 1.0 feed");
11     $feed->link("http://example.org/");
12    
13     my $entry = XML::Feed::Entry->new('Atom');
14     $entry->title("1st Entry");
15     $entry->link("http://example.org/");
16     $entry->category("blah");
17     $entry->content("<p>Hello world.</p>");
18    
19     $feed->add_entry($entry);
20    
21     my $xml = $feed->as_xml;
22     like $xml, qr!<feed xmlns="http://www.w3.org/2005/Atom"!;
23     like $xml, qr!<content .*type="xhtml">!;
24     like $xml, qr!<div xmlns="http://www.w3.org/1999/xhtml">!;
25    
26     # roundtrip
27     $feed = XML::Feed->parse(\$xml);
28     is $feed->format, 'Atom';
29     is $feed->title, "foo";
30     is $feed->description, "Atom 1.0 feed";
31     is $feed->link, "http://example.org/";
32    
33     my @entries = $feed->entries;
34     is @entries, 1;
35     $entry = $entries[0];
36    
37     is $entry->title, '1st Entry';
38     is $entry->link, 'http://example.org/';
39     is $entry->category, 'blah';
40     is $entry->content->type, 'text/html';
41     like $entry->content->body, qr!\s*<p>Hello world.</p>\s*!s;
42    
43    
44    

  ViewVC Help
Powered by ViewVC 1.1.26