/[webpac2]/trunk/t/3-normalize-xml.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /trunk/t/3-normalize-xml.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 62 - (hide annotations)
Tue Nov 15 14:31:12 2005 UTC (18 years, 5 months ago) by dpavlin
File MIME type: application/x-troff
File size: 1060 byte(s)
 r8884@llin:  dpavlin | 2005-11-15 14:46:07 +0100
 fix small warnings

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

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26