File: 13_attrib.t

package info (click to toggle)
libhtml-tableextract-perl 2.15-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 284 kB
  • sloc: perl: 1,558; makefile: 2
file content (39 lines) | stat: -rwxr-xr-x 1,097 bytes parent folder | download | duplicates (7)
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
#!/usr/bin/perl

use strict;
use lib './lib';
use Test::More tests => 556;

use FindBin;
use lib $FindBin::RealBin;
use testload;

my $file = "$Dat_Dir/basic.html";

use HTML::TableExtract;

my($label, $te, @tables);

# By border
$label = 'by attribute (regular)';
$te = HTML::TableExtract->new( attribs => { border => 1 } );
ok($te->parse_file($file), "$label (parse_file)");
@tables = $te->tables;
cmp_ok(@tables, '==', 3, "$label (extract count)");
good_data($_, "$label (data)") foreach @tables;

# By cellpadding
$label = 'by attribute (subset)';
$te = HTML::TableExtract->new( attribs => { cellpadding => 1 } );
ok($te->parse_file($file), "$label (parse_file)");
@tables = $te->tables;
cmp_ok(@tables, '==', 1, "$label (extract count)");
good_data($_, "$label (data)") foreach @tables;

# By cellpadding existence
$label = 'by attribute (undef)';
$te = HTML::TableExtract->new( attribs => { cellpadding => undef } );
ok($te->parse_file($file), "$label (parse_file)");
@tables = $te->tables;
cmp_ok(@tables, '==', 1, "$label (extract count)");
good_data($_, "$label (data)") foreach @tables;