X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=t%2F1-config.t;fp=t%2F1-config.t;h=73850220f016226f02c51274d7f5f4d7b8fd84ff;hb=449fc14e93251890982aa5c8109f549e107cd530;hp=0000000000000000000000000000000000000000;hpb=f8d4957b5d39572c5dda691ec9cde15e756d28c2;p=webpac2 diff --git a/t/1-config.t b/t/1-config.t new file mode 100755 index 0000000..7385022 --- /dev/null +++ b/t/1-config.t @@ -0,0 +1,34 @@ +#!/usr/bin/perl -w + +use strict; +use Test::More tests => 8; +use Test::Exception; +use blib; + +use Data::Dump qw/dump/; +use Cwd qw/abs_path/; + +BEGIN { +use_ok( 'WebPAC::Config' ); +} + +my $debug = shift @ARGV; + +ok(my $abs_path = abs_path($0), "abs_path"); +$abs_path =~ s#/[^/]*$#/#; + +my $path = "$abs_path/conf/test.yml"; + +ok(my $c = new WebPAC::Config( path => $path ), "new"); + +cmp_ok($c->{path}, 'eq', $path, "path $path"); + +ok($c->{config}, "config exist"); + +isa_ok($c->databases, 'HASH', "databases"); + +my @names = $c->databases; + +isa_ok(\@names, 'ARRAY', "databases names"); + +cmp_ok(@names, '==', 3, "got 3 names");