1 |
#!/usr/bin/perl -w |
#!/usr/bin/perl -w |
2 |
|
|
3 |
use Test::More tests => 8; |
use Test::More tests => 10; |
4 |
use Test::Exception; |
use Test::Exception; |
5 |
use Cwd qw/abs_path/; |
use Cwd qw/abs_path/; |
6 |
use blib; |
use blib; |
7 |
use strict; |
use strict; |
8 |
|
use Data::Dumper; |
9 |
|
|
10 |
BEGIN { |
BEGIN { |
11 |
use_ok( 'WebPAC::Normalize::XML' ); |
use_ok( 'WebPAC::Normalize::XML' ); |
15 |
$abs_path =~ s#/[^/]*$#/#; |
$abs_path =~ s#/[^/]*$#/#; |
16 |
diag "abs_path: $abs_path"; |
diag "abs_path: $abs_path"; |
17 |
|
|
18 |
|
throws_ok { new WebPAC::Normalize::XML( lookup_regex => 'foo' ) } qr/pair/, "lookup_regex without lookup"; |
19 |
|
throws_ok { new WebPAC::Normalize::XML( lookup => 'bar' ) } qr/pair/, "lookup without lookup_regex"; |
20 |
|
|
21 |
ok(my $n = new WebPAC::Normalize::XML( debug => 0 ), "new"); |
ok(my $n = new WebPAC::Normalize::XML( debug => 0 ), "new"); |
22 |
|
|
23 |
throws_ok { $n->open() } qr/tag/, "open without tag"; |
throws_ok { $n->open() } qr/tag/, "open without tag"; |
24 |
throws_ok { $n->open( tag => 'isis' ) } qr/xml_file/, "open without xml_file"; |
throws_ok { $n->open( tag => 'isis' ) } qr/xml_file/, "open without xml_file"; |
25 |
throws_ok { $n->open( tag => 'isis', xml_file => 'foo' ) } qr/file.*doesn't exist/, "open with invalid xml_file"; |
throws_ok { $n->open( tag => 'isis', xml_file => '/foo/bar/baz' ) } qr/file.*doesn't exist/, "open with invalid xml_file"; |
26 |
ok( $n->open( |
ok( $n->open( |
27 |
tag => 'isis', |
tag => 'isis', |
28 |
xml_file => "$abs_path../conf/normalize/isis.xml", |
xml_file => "$abs_path../conf/normalize/isis.xml", |
36 |
|
|
37 |
ok(my @ds = $n->data_structure( $rec ), "data_structure"); |
ok(my @ds = $n->data_structure( $rec ), "data_structure"); |
38 |
|
|
39 |
use Data::Dumper; |
#diag Dumper(@ds); |
|
diag Dumper(\@ds); |
|