File: tagname.t

package info (click to toggle)
libweb-query-perl 1.01-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 424 kB
  • sloc: perl: 984; xml: 329; makefile: 2
file content (23 lines) | stat: -rw-r--r-- 531 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use strict;
use warnings;

use Test2::V0;

my @modules = qw/ Web::Query Web::Query::LibXML /;

plan tests => scalar @modules;

for my $module ( @modules ) {
    subtest $module => sub {
        eval "require $module; 1" 
            or plan skip_all => "couldn't load $module";

        my $wq = $module->new_from_html(<<'END');
        <div><p><b>hello</b></p><p>there</p></div>
END

        $wq->find('p')->each(sub{ $_->tagname('q') });

        is $wq->as_html, '<div><q><b>hello</b></q><q>there</q></div>', 'p -> q';
    };
}