root/Web-Scraper/trunk/t/13_textnode.t

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

Checking in changes prior to tagging of version 0.16. Changelog diff is:

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     want     => 'chomp',
10     expected => 'chomp',
11 };
12
13 run {
14     my $block = shift;
15     my $s = scraper {
16         process $block->selector, want => $block->want;
17         result 'want';
18     };
19     my $want = $s->scrape($block->html);
20     is $want, $block->expected, $block->name;
21 };
22
23 __DATA__
24
25 === TEXT
26 --- html
27 <p><s>foo</s> bar</p>
28 --- selector
29 //p/node()[2]
30 --- want
31 TEXT
32 --- expected
33  bar
34
35 === TEXT
36 --- html
37 <p><s>foo</s> bar</p>
38 --- selector
39 //p/node()[2]
40 --- want
41 TEXT
42 --- expected
43  bar
44
45 === TEXT
46 --- html
47 <p><s>foo</s> bar &amp; baz</p>
48 --- selector
49 //p/node()[2]
50 --- want
51 TEXT
52 --- expected
53  bar & baz
54
55 === RAW HTML
56 --- html
57 <p><s>foo</s> bar &amp; baz</p>
58 --- selector
59 //p/node()[2]
60 --- want
61 RAW
62 --- expected
63  bar &amp; baz
Note: See TracBrowser for help on using the browser.