use strict;
use warnings;
use Test::More 'no_plan';
#use Test::LongString;
use OpenResty::FeedWriter::RSS;
my $rss = OpenResty::FeedWriter::RSS->new(
{
title => '
你好么?
',
link => 'http://blog.agentzh.org/',
description => 'agentzh\'s madhouse',
language => 'en-us',
copyright => 'Copyright by Agent Zhang',
pubDate => 'Sat, 15 Nov 2003 0:00:01 GMT',
lastBuildDate => 'Mon, 25 Jan 2004 0:00:01 GMT',
}
);
ok $rss, 'obj ok';
isa_ok $rss, 'OpenResty::FeedWriter::RSS';
eval { $rss->as_xml };
ok $@, 'eval failed as expected';
like $@, qr/No entries found/, 'error as expected';
$rss = OpenResty::FeedWriter::RSS->new(
{
title => '
你好么?
',
link => 'http://blog.agentzh.org/',
description => 'agentzh\'s madhouse',
language => 'en-us',
copyright => 'Copyright by Agent Zhang',
pubDate => 'Sat, 15 Nov 2003 0:00:01 GMT',
lastBuildDate => 'Mon, 25 Jan 2004 0:00:01 GMT',
}
);
$rss->add_entry(
{
title => 'Hello, world',
author => 'agentzh',
comments => 'http://blog.agentzh.org/#post-3:comments',
description => 'Blah blah blah...',
pubDate => '2007-03-04 5:34',
category => 'IT',
link => 'http://blog.agentzh.org/#post-3',
}
);
$rss->add_entry(
{ title => '
我来了!
', link => 'http://foo.com',
description => 'howdy!' }
);
is $rss->as_xml, <<'_EOC_';
<h1>你好么?</h1>
http://blog.agentzh.org/
agentzh's madhouseen-usCopyright by Agent ZhangSat, 15 Nov 2003 0:00:01 GMTMon, 25 Jan 2004 0:00:01 GMTHello, world
http://blog.agentzh.org/#post-3
Blah blah blah...agentzhhttp://blog.agentzh.org/#post-3:comments2007-03-04 5:34IThttp://blog.agentzh.org/#post-3<h1>我来了!</h1>
http://foo.com
howdy!http://foo.com
_EOC_