root/Web-Scraper/trunk/t/06_define.t

Revision 2243 (checked in by miyagawa, 13 years ago)

rename .t

Line 
1 use strict;
2 use Test::Base;
3
4 use Web::Scraper;
5 plan tests => 1 * blocks;
6
7 filters {
8     selector => 'chomp',
9     expected => 'chomp',
10 };
11
12 run {
13     my $block = shift;
14     my $s = Web::Scraper->define(sub {
15         process $block->selector, text => 'TEXT';
16         result 'text';
17     });
18     my $text = $s->scrape($block->html);
19     is $text, $block->expected, $block->name;
20 };
21
22 __DATA__
23
24 ===
25 --- html
26 <div id="foo">bar</div>
27 --- selector
28 div#foo
29 --- expected
30 bar
Note: See TracBrowser for help on using the browser.