85f7bb028546e2caed0010ca4054cd7d58c9b68a
[webpac2] / t / 3-normalize-xml.t
1 #!/usr/bin/perl -w
2
3 use Test::More tests => 6;
4 use Test::Exception;
5 use Cwd qw/abs_path/;
6 use blib;
7 use strict;
8
9 BEGIN {
10 use_ok( 'WebPAC::Normalize::XML' );
11 }
12
13 ok(my $abs_path = abs_path($0), "abs_path");
14 $abs_path =~ s#/[^/]*$#/#;
15 diag "abs_path: $abs_path";
16
17 throws_ok { new WebPAC::Normalize::XML() } qr/tag/, "new without tag";
18 throws_ok { new WebPAC::Normalize::XML( tag => 'isis' ) } qr/xml_file/, "new without xml_file";
19 throws_ok { new WebPAC::Normalize::XML( tag => 'isis', xml_file => 'foo' ) } qr/file.*doesn't exist/, "new with invalid xml_file";
20 ok(my $isis = new WebPAC::Normalize::XML(
21         tag => 'isis',
22         xml_file => "$abs_path../conf/normalize/isis.xml",
23         debug => 1,
24 ), "new");
25
26