--- trunk/t/3-normalize-xml.t 2005/07/16 22:57:26 12 +++ trunk/t/3-normalize-xml.t 2005/07/16 23:56:14 13 @@ -1,6 +1,6 @@ #!/usr/bin/perl -w -use Test::More tests => 6; +use Test::More tests => 8; use Test::Exception; use Cwd qw/abs_path/; use blib; @@ -14,13 +14,24 @@ $abs_path =~ s#/[^/]*$#/#; diag "abs_path: $abs_path"; -throws_ok { new WebPAC::Normalize::XML() } qr/tag/, "new without tag"; -throws_ok { new WebPAC::Normalize::XML( tag => 'isis' ) } qr/xml_file/, "new without xml_file"; -throws_ok { new WebPAC::Normalize::XML( tag => 'isis', xml_file => 'foo' ) } qr/file.*doesn't exist/, "new with invalid xml_file"; -ok(my $isis = new WebPAC::Normalize::XML( +ok(my $n = new WebPAC::Normalize::XML( debug => 1 ), "new"); + + +throws_ok { $n->open() } qr/tag/, "open without tag"; +throws_ok { $n->open( tag => 'isis' ) } qr/xml_file/, "open without xml_file"; +throws_ok { $n->open( tag => 'isis', xml_file => 'foo' ) } qr/file.*doesn't exist/, "open with invalid xml_file"; +ok( $n->open( tag => 'isis', xml_file => "$abs_path../conf/normalize/isis.xml", - debug => 1, -), "new"); +), "open"); + +my $rec = { + '000' => [ '001' ], + '800' => [ 'foo' ], + '900' => [ 'bar' ], +}; +ok(my @ds = $n->data_structure( $rec ), "data_structure"); +use Data::Dumper; +diag Dumper(\@ds);