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

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

Fixed Subscription::OPML bug that Conainers tag are not properly dereferenced. Added test.

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