File: 15_absolute_hash.t

package info (click to toggle)
libweb-scraper-perl 0.38-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 308 kB
  • sloc: perl: 473; makefile: 2
file content (31 lines) | stat: -rw-r--r-- 545 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use strict;
use Test::Base;

use Web::Scraper;
plan tests => 1 * blocks;

filters {
    expected => 'chomp',
};

run {
    my $block = shift;
    my $s = scraper {
        process $block->selector, 'want[]' => { link => '@href' };
        result 'want';
    };
    my $want = $s->scrape($block->html, $block->url);
    is $want->[0]->{link}, $block->expected, $block->name;
};

__DATA__

===
--- url: http://example.com/
--- html
<a id="foo" href="foo.html"><img src="foo.jpg" /></a>
--- selector
a#foo
--- expected
http://example.com/foo.html