1 |
#!/usr/bin/perl -w |
#!/usr/bin/perl -w |
2 |
|
|
3 |
use Test::More tests => 6; |
use Test::More tests => 8; |
4 |
use Test::Exception; |
use Test::Exception; |
5 |
use Cwd qw/abs_path/; |
use Cwd qw/abs_path/; |
6 |
use blib; |
use blib; |
14 |
$abs_path =~ s#/[^/]*$#/#; |
$abs_path =~ s#/[^/]*$#/#; |
15 |
diag "abs_path: $abs_path"; |
diag "abs_path: $abs_path"; |
16 |
|
|
17 |
throws_ok { new WebPAC::Normalize::XML() } qr/tag/, "new without tag"; |
ok(my $n = new WebPAC::Normalize::XML( debug => 1 ), "new"); |
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"; |
throws_ok { $n->open() } qr/tag/, "open without tag"; |
20 |
ok(my $isis = new WebPAC::Normalize::XML( |
throws_ok { $n->open( tag => 'isis' ) } qr/xml_file/, "open without xml_file"; |
21 |
|
throws_ok { $n->open( tag => 'isis', xml_file => 'foo' ) } qr/file.*doesn't exist/, "open with invalid xml_file"; |
22 |
|
ok( $n->open( |
23 |
tag => 'isis', |
tag => 'isis', |
24 |
xml_file => "$abs_path../conf/normalize/isis.xml", |
xml_file => "$abs_path../conf/normalize/isis.xml", |
25 |
debug => 1, |
), "open"); |
26 |
), "new"); |
|
27 |
|
my $rec = { |
28 |
|
'000' => [ '001' ], |
29 |
|
'800' => [ 'foo' ], |
30 |
|
'900' => [ 'bar' ], |
31 |
|
}; |
32 |
|
|
33 |
|
ok(my @ds = $n->data_structure( $rec ), "data_structure"); |
34 |
|
|
35 |
|
use Data::Dumper; |
36 |
|
diag Dumper(\@ds); |