File: testlib.pm

package info (click to toggle)
libtest-html-content-perl 0.13-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 328 kB
  • sloc: perl: 1,393; makefile: 2
file content (42 lines) | stat: -rwxr-xr-x 899 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
40
41
42
use strict;
use Test::More;

use vars qw(%modules);
BEGIN {
  $modules{pureperl} = \&run_pureperl;
  eval { require XML::XPath; $XML::XPath::VERSION >= 1.13 and $modules{xpath} = \&run_xpath };
  eval { require XML::LibXML; $modules{libxml} = \&run_libxml };
};

sub main::runtests {
  my ($count,$code) = @_;
  my @candidates = (sort keys %modules);

  plan( tests => 1+ $count * scalar @candidates );
  use_ok('Test::HTML::Content');

  for my $implementation (@candidates) {
    my $test = $modules{$implementation};
    $test->($count,$code);
  };
};

sub run_libxml {
  my ($count,$code) = @_;
  Test::HTML::Content::install_libxml();
  $code->('XML::LibXML');
};

sub run_xpath {
  my ($count,$code) = @_;
  Test::HTML::Content::install_xpath();
  $code->('XML::XPath');
};

sub run_pureperl {
  my ($count,$code) = @_;
  Test::HTML::Content::install_pureperl();
  $code->('PurePerl');
};

1;