data_source seems to work
[webpac2] / t / 3-normalize-xml.t
index 85f7bb0..8247c2d 100755 (executable)
@@ -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 @@ ok(my $abs_path = abs_path($0), "abs_path");
 $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);