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