/[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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 700 - (show annotations)
Mon Sep 25 12:51:33 2006 UTC (17 years, 7 months ago) by dpavlin
File MIME type: application/x-troff
File size: 1225 byte(s)
 r993@llin:  dpavlin | 2006-09-25 13:52:43 +0200
 upgrade $input->{normalize} to ARRAY

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

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26