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

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

Subscription::XPath: allow non-absolute link ... even if it sounds weird

Line 
1 use strict;
2 use t::TestPlagger;
3
4 test_plugin_deps;
5 plan tests => 2;
6 run_eval_expected;
7
8 __END__
9
10 === test file
11 --- input config
12 plugins:
13   - module: Subscription::XPath
14     config:
15       url: file://$t::TestPlagger::BaseDirURI/t/samples/xoxo.html
16       xpath: //ul[@class="xoxo" or @class="subscriptionlist"]//a
17   - module: Aggregator::Null
18 --- expected
19 my @feeds = map $_->url, $context->subscription->feeds;
20 is_deeply(
21     \@feeds,
22     [ 'http://blog.bulknews.net/mt/',
23       'http://bulknews.typepad.com/',
24       'http://subtech.g.hatena.ne.jp/miyagawa/']
25 );
26
27 === test with relative link path
28 --- input config
29 plugins:
30   - module: Subscription::XPath
31     config:
32       url: file://$t::TestPlagger::BaseDirURI/t/samples/xoxo-relative.html
33       xpath: //a
34   - module: Aggregator::Null
35 --- expected
36 is $context->subscription->feeds->[0]->url, "file://$t::TestPlagger::BaseDirURI/t/samples/foo.html";
Note: See TracBrowser for help on using the browser.