]> iEval git - html-element-library.git/blame - t/lib.pm
Bump version and update Changes
[html-element-library.git] / t / lib.pm
CommitLineData
aa016126
MG
1package t::lib;
2use strict;
3use warnings;
4
5use File::Slurp qw/read_file/;
6use HTML::TreeBuilder;
7use HTML::Element::Library;
8use Test::More ();
9use Test::XML;
10
11use parent qw/Exporter/;
12our @EXPORT = qw/is is_deeply is_xml slurp mktree isxml/;
13our $VERSION = '0.001'; # Exporter needs a $VERSION
14
15sub 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
24sub slurp { scalar read_file @_ }
25
26sub mktree {
27 my ($file) = @_;
28 HTML::TreeBuilder->new_from_file($file)->disembowel;
29}
30
31sub 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.018697 seconds and 4 git commands to generate.