From: Karen Etheridge Date: Fri, 11 May 2012 17:17:40 +0000 (-0700) Subject: TODO tests for configfile in constructor failure X-Git-Tag: v0.44~4 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMooseX-Getopt.git;a=commitdiff_plain;h=1c9973b6fd145c47387b3128f6ffcacdac6eb1ab TODO tests for configfile in constructor failure --- diff --git a/t/112_configfile_constructor_arg.t b/t/112_configfile_constructor_arg.t new file mode 100644 index 0000000..7b55a83 --- /dev/null +++ b/t/112_configfile_constructor_arg.t @@ -0,0 +1,41 @@ +use strict; +use warnings; + +use Test::Requires + 'MooseX::SimpleConfig'; # skip all if not installed + +# respect the configfile value passed into the constructor. + +use Test::More tests => 2; + +{ + package Foo; + use Moose; + with 'MooseX::Getopt', 'MooseX::SimpleConfig'; + + has foo => ( + is => 'ro', isa => 'Str', + default => 'foo default', + ); +} + +TODO: +{ + local $TODO = "doh, this doesn't work!"; + + my $configfile = 't/112_configfile_constructor_arg.yml'; + + my $obj = Foo->new_with_options(configfile => $configfile); + + is( + $obj->configfile, + $configfile, + 'configfile value is used from the constructor', + ); + is( + $obj->foo, + 'foo value', + 'value is read in from the config file', + ); +} + diff --git a/t/112_configfile_constructor_arg.yml b/t/112_configfile_constructor_arg.yml new file mode 100644 index 0000000..8781cd8 --- /dev/null +++ b/t/112_configfile_constructor_arg.yml @@ -0,0 +1,2 @@ +--- + foo: foo value