Permalink
Browse files

tests for new input type cfggeneral

  • Loading branch information...
1 parent 0b2ac5e commit 69926db02af5d0f4e391ec7bf403b8d23035c8fa @renormalist committed Oct 1, 2009
Showing with 16 additions and 1 deletion.
  1. +16 −1 t/app_dpath.t
View
@@ -4,7 +4,7 @@ use strict;
use warnings;
use Data::Dumper;
-use Test::More tests => 8;
+use Test::More tests => 16;
use Test::Deep;
use JSON;
use YAML::Syck;
@@ -35,6 +35,10 @@ sub check {
elsif ($outtype eq "yaml") {
$result = YAML::Syck::Load($output);
}
+ elsif ($outtype eq "cfggeneral") {
+ my %data = Config::General->new(-String => $output)->getall;
+ $result = \%data;
+ }
elsif ($outtype eq "dumper")
{
eval "\$result = my $output";
@@ -54,3 +58,14 @@ check (qw(xml dumper), '//description[ value =~ m(use Data::DPath) ]/../_childre
check (qw(ini dumper), '//description[ value =~ m(use Data::DPath) ]/../number', [ "1" ]);
check (qw(ini json), '//description[ value =~ m(use Data::DPath) ]/../number', [ "1" ]);
check (qw(ini yaml), '//description[ value =~ m(use Data::DPath) ]/../number', [ "1" ]);
+
+# Config::General is also somewhat special
+check (qw(cfggeneral json), '/etc/base', [ "/usr" ]);
+check (qw(cfggeneral json), '//home', [ "/usr/home/max" ]);
+check (qw(cfggeneral json), '//mono//bl', [ 2 ]);
+check (qw(cfggeneral json), '//log', [ "/usr/log/logfile" ]);
+
+check (qw(cfggeneral yaml), '/etc/base', [ "/usr" ]);
+check (qw(cfggeneral yaml), '//home', [ "/usr/home/max" ]);
+check (qw(cfggeneral yaml), '//mono//bl', [ 2 ]);
+check (qw(cfggeneral yaml), '//log', [ "/usr/log/logfile" ]);

0 comments on commit 69926db

Please sign in to comment.