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

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

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

=== Changes
==================================================================
--- Changes (revision 8907)
+++ Changes (local)
@@ -1,5 +1,10 @@

Revision history for Perl extension Web
Scraper

+0.23 Sat Nov 24 17:21:14 PST 2007
+ - Upped Web::Scraper dependency
+ - Skip & test until HTML::TreeBuilder?::XPath fixes it
+ - removed eg/search-cpan.pl
+

0.22 Wed Oct 17 17:51:54 PDT 2007

- 's' on scraper shell now prints to pager (e.g. less) if PAGER is set


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 --- SKIP
57 --- html
58 <p><s>foo</s> bar &amp; baz</p>
59 --- selector
60 //p/node()[2]
61 --- want
62 RAW
63 --- expected
64  bar &amp; baz
Note: See TracBrowser for help on using the browser.