use warnings;
use Test::More;
+use Config::Any;
use Config::Any::General;
if ( !Config::Any::General->is_supported ) {
plan skip_all => 'Config::General format not supported';
}
else {
- plan tests => 7;
+ plan tests => 9;
}
{
ok( !$config, 'config load failed' );
ok( $@, "error thrown ($@)" );
}
+
+# parse error generated on invalid config
+{
+ my $file = 't/invalid/conf.conf';
+ my $config = eval { Config::Any->load_files( { files => [$file], use_ext => 1} ) };
+
+ ok( !$config, 'config load failed' );
+ ok( $@, "error thrown ($@)" );
+}
use warnings;
use Test::More;
+use Config::Any;
use Config::Any::INI;
if ( !Config::Any::INI->is_supported ) {
plan skip_all => 'INI format not supported';
}
else {
- plan tests => 13;
+ plan tests => 15;
}
{
ok( !$config, 'config load failed' );
ok( $@, "error thrown ($@)" );
}
+
+# parse error generated on invalid config
+{
+ my $file = 't/invalid/conf.ini';
+ my $config = eval { Config::Any->load_files( { files => [$file], use_ext => 1} ) };
+
+ ok( !$config, 'config load failed' );
+ ok( $@, "error thrown ($@)" );
+}
use warnings;
use Test::More;
+use Config::Any;
use Config::Any::JSON;
if ( !Config::Any::JSON->is_supported ) {
plan skip_all => 'JSON format not supported';
}
else {
- plan tests => 4;
+ plan tests => 6;
}
{
ok( !$config, 'config load failed' );
ok( $@, "error thrown ($@)" );
}
+
+# parse error generated on invalid config
+{
+ my $file = 't/invalid/conf.json';
+ my $config = eval { Config::Any->load_files( { files => [$file], use_ext => 1} ) };
+
+ ok( !$config, 'config load failed' );
+ ok( $@, "error thrown ($@)" );
+}
use strict;
use warnings;
-use Test::More tests => 5;
-
+use Test::More tests => 7;
+use Config::Any;
use Config::Any::Perl;
{
ok( !$config, 'config load failed' );
ok( $@, "error thrown ($@)" );
}
+
+# parse error generated on invalid config
+{
+ my $file = 't/invalid/conf.pl';
+ my $config = eval { Config::Any->load_files( { files => [$file], use_ext => 1} ) };
+
+ ok( !$config, 'config load failed' );
+ ok( $@, "error thrown ($@)" );
+}
use warnings;
use Test::More;
+use Config::Any;
use Config::Any::XML;
if ( !Config::Any::XML->is_supported ) {
plan skip_all => 'XML format not supported';
}
else {
- plan tests => 6;
+ plan tests => 8;
}
{
ok( $config, 'config loaded' );
ok( !$@, 'no error thrown' );
}
+
+# parse error generated on invalid config
+{
+ my $file = 't/invalid/conf.xml';
+ my $config = eval { Config::Any->load_files( { files => [$file], use_ext => 1} ) };
+
+ ok( !$config, 'config load failed' );
+ ok( $@, "error thrown ($@)" );
+}
+
no warnings 'once';
use Test::More;
+use Config::Any;
use Config::Any::YAML;
if ( !Config::Any::YAML->is_supported ) {
plan skip_all => 'YAML format not supported';
}
else {
- plan tests => 4;
+ plan tests => 6;
}
{
ok( !$config, 'config load failed' );
ok( $@, "error thrown ($@)" );
}
+
+# parse error generated on invalid config
+{
+ my $file = 't/invalid/conf.yml';
+ my $config = eval { Config::Any->load_files( { files => [$file], use_ext => 1} ) };
+
+ ok( !$config, 'config load failed' );
+ ok( $@, "error thrown ($@)" );
+}