File: 21_html5.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 (44 lines) | stat: -rw-r--r-- 623 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
32
33
34
35
36
37
38
39
40
41
42
43
44
use strict;
use Test::Base;

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

filters {
    selector => 'chomp',
    expected => [ 'chomp', 'newline' ],
    html     => 'newline',
};

sub newline {
    s/\\n\n/\n/g;
}

run {
    my $block = shift;
    my $s = scraper {
        process $block->selector, want => 'HTML';
        result 'want';
    };
    my $want = $s->scrape($block->html);
    is $want, $block->expected, $block->name;
};

__DATA__

=== header
--- html
<header>hello</header>
--- selector
header
--- expected
hello

=== section
--- html
<header>hello</header>
--- selector
header
--- expected
hello