root/trunk/plagger/t/plugins/Subscription-OPML/subscription.t

Revision 1500 (checked in by miyagawa, 14 years ago)

rewrite OPML parser using XML::LibXML::SAX. YAY! Fixes #383

Line 
1 use strict;
2 use t::TestPlagger;
3
4 test_plugin_deps;
5 plan 'no_plan';
6 run_eval_expected;
7
8 __END__
9
10 === test file
11 --- input config
12 plugins:
13   - module: Subscription::OPML
14     config:
15       url: file://$t::TestPlagger::BaseDirURI/t/samples/opml.xml
16   - module: Aggregator::Null
17 --- expected
18 is $context->subscription->feeds->[0]->url, "http://blog.bulknews.net/mt/index.rdf";
19 is $context->subscription->feeds->[0]->link, "http://blog.bulknews.net/mt/";
20 is $context->subscription->feeds->[0]->title, "blog.bulknews.net";
21
22 === test nested subs
23 --- input config
24 plugins:
25   - module: Subscription::OPML
26     config:
27       url: file://$t::TestPlagger::BaseDirURI/t/samples/opml-nested.xml
28   - module: Aggregator::Null
29 --- expected
30 my @feeds = sort { $a->url cmp $b->url } $context->subscription->feeds;
31
32 is $feeds[0]->url, "http://blog.bulknews.net/mt/index.rdf";
33 is $feeds[0]->link, "http://blog.bulknews.net/mt/";
34 is $feeds[0]->title, "blog.bulknews.net";
35 is_deeply $feeds[0]->tags, [ 'Foo' ];
36
37 is $feeds[1]->url, "http://subtech.g.hatena.ne.jp/miyagawa/rss";
38 is $feeds[1]->link, "http://subtech.g.hatena.ne.jp/miyagawa/";
39 is $feeds[1]->title, "Bulknews::Subtech";
40 is_deeply $feeds[1]->tags, [ 'Bar', 'Baz' ];
Note: See TracBrowser for help on using the browser.