]> iEval git - html-element-library.git/blob - t/lib.pm
Remove use v5.14; from t/perlcritic.t
[html-element-library.git] / t / lib.pm
1 package t::lib;
2 use strict;
3 use warnings;
4
5 use File::Slurp qw/read_file/;
6 use HTML::TreeBuilder;
7 use HTML::Element::Library;
8 use Test::More ();
9 use Test::XML;
10
11 use parent qw/Exporter/;
12 our @EXPORT = qw/is is_deeply is_xml slurp mktree isxml/;
13 our $VERSION = '0.001'; # Exporter needs a $VERSION
14
15 sub import {
16 my ($self, @args) = @_;
17 strict->import;
18 warnings->import;
19 Test::More->import(@args);
20
21 $self->export_to_level(1, $self);
22 }
23
24 sub slurp { scalar read_file @_ }
25
26 sub mktree {
27 my ($file) = @_;
28 HTML::TreeBuilder->new_from_file($file)->disembowel;
29 }
30
31 sub isxml {
32 my ($tree, $file, $name) = @_;
33 my $res = ref $tree eq 'SCALAR' ? $$tree : $tree->as_XML;
34 my $exp = ref $file eq 'SCALAR' ? $$file : slurp $file;
35 is_xml $res, $exp, $name
36 }
This page took 0.047371 seconds and 4 git commands to generate.