/[webpac2]/trunk/t/1-config.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

Diff of /trunk/t/1-config.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 681 by dpavlin, Sun Sep 24 15:28:49 2006 UTC revision 949 by dpavlin, Thu Nov 1 00:16:48 2007 UTC
# Line 1  Line 1 
1  #!/usr/bin/perl -w  #!/usr/bin/perl -w
2    
3  use strict;  use strict;
 use Test::More tests => 8;  
 use Test::Exception;  
4  use blib;  use blib;
5    
6  use Data::Dump qw/dump/;  use Test::More tests => 28;
 use Cwd qw/abs_path/;  
7    
8  BEGIN {  BEGIN {
9    use_ok( 'WebPAC::Test' );
10  use_ok( 'WebPAC::Config' );  use_ok( 'WebPAC::Config' );
11  }  }
12    
 my $debug = shift @ARGV;  
   
 ok(my $abs_path = abs_path($0), "abs_path");  
 $abs_path =~ s#/[^/]*$#/#;  
   
13  my $path = "$abs_path/conf/test.yml";  my $path = "$abs_path/conf/test.yml";
14    
15  ok(my $c = new WebPAC::Config( path => $path ), "new");  ok(my $config = new WebPAC::Config( path => $path ), "new");
   
 cmp_ok($c->{path}, 'eq', $path, "path $path");  
16    
17  ok($c->{config}, "config exist");  cmp_ok($config->{path}, 'eq', $path, "path $path");
18    
19  isa_ok($c->databases, 'HASH', "databases");  ok($config->{config}, "config exist");
20    
21  my @names = $c->databases;  # $config->databases
22    
23    isa_ok($config->databases, 'HASH', "databases");
24    my @names = $config->databases;
25  isa_ok(\@names, 'ARRAY', "databases names");  isa_ok(\@names, 'ARRAY', "databases names");
   
26  cmp_ok(@names, '==', 3, "got 3 names");  cmp_ok(@names, '==', 3, "got 3 names");
27    isa_ok($config->databases, 'HASH', "databases");
28    
29    diag '$config->webpac = ', dump($config->webpac) if ($debug);
30    
31    isa_ok($config->webpac, 'HASH', "webpac");
32    my @inputs = $config->webpac('inputs');
33    diag "inputs = ",dump( @inputs ) if ($debug);
34    isa_ok(\@inputs, 'ARRAY', "inputs");
35    cmp_ok(@inputs, '==', 2, "got 2 webpac inputs");
36    
37    $config->iterate_inputs(sub {
38            my ($input,$database,$db_config) = @_;
39            isa_ok($input, 'HASH', 'input');
40            ok($database, 'database');
41            isa_ok($db_config, 'HASH', 'database config');
42            isa_ok($input->{normalize}, 'ARRAY', 'normalize');
43    });

Legend:
Removed from v.681  
changed lines
  Added in v.949

  ViewVC Help
Powered by ViewVC 1.1.26