#!/usr/bin/perl use strict; use warnings; use Test::More tests => 24; use Test::Exception; BEGIN { use_ok('IOC::Config::XML'); } ## error tests { my $conf = IOC::Config::XML->new(); isa_ok($conf, 'IOC::Config::XML'); # read errors throws_ok { $conf->read(); } 'IOC::InsufficientArguments', '... got the error we expected'; throws_ok { $conf->read(''); } 'IOC::InsufficientArguments', '... got the error we expected'; throws_ok { $conf->read(0); } 'IOC::InsufficientArguments', '... got the error we expected'; # parsing errors throws_ok { $conf->read(''); } 'IOC::ConfigurationError', '... got the error we expected'; throws_ok { $conf->read(''); } 'IOC::ConfigurationError', '... got the error we expected'; IOC::Registry->new()->DESTROY(); throws_ok { $conf->read(''); } 'IOC::ConfigurationError', '... got the error we expected'; IOC::Registry->new()->DESTROY(); throws_ok { $conf->read('25'); } 'IOC::ConfigurationError', '... got the error we expected'; IOC::Registry->new()->DESTROY(); throws_ok { $conf->read(q{ 25 28 }); } 'IOC::ConfigurationError', '... got the error we expected'; IOC::Registry->new()->DESTROY(); throws_ok { $conf->read(q{ }); } 'IOC::ConfigurationError', '... got the error we expected'; IOC::Registry->new()->DESTROY(); throws_ok { $conf->read(q{ }); } 'IOC::OperationFailed', '... got the error we expected'; IOC::Registry->new()->DESTROY(); throws_ok { $conf->read(q{ 25 }); } 'IOC::ConfigurationError', '... got the error we expected'; IOC::Registry->new()->DESTROY(); throws_ok { $conf->read(q{ }); } 'IOC::ConfigurationError', '... got the error we expected'; IOC::Registry->new()->DESTROY(); throws_ok { $conf->read(q{ }); } 'IOC::ConfigurationError', '... got the error we expected'; IOC::Registry->new()->DESTROY(); throws_ok { $conf->read(q{ }); } 'IOC::ConfigurationError', '... got the error we expected'; IOC::Registry->new()->DESTROY(); throws_ok { $conf->read(q{ [ test }); } 'IOC::OperationFailed', '... got the error we expected'; IOC::Registry->new()->DESTROY(); throws_ok { $conf->read(q{ }); } 'IOC::ConfigurationError', '... got the error we expected'; IOC::Registry->new()->DESTROY(); throws_ok { $conf->read(q{ }); } 'IOC::ConfigurationError', '... got the error we expected'; IOC::Registry->new()->DESTROY(); throws_ok { $conf->read(q{ }); } 'IOC::ConfigurationError', '... got the error we expected'; IOC::Registry->new()->DESTROY(); throws_ok { $conf->read(q{ }); } 'IOC::ConfigurationError', '... got the error we expected'; IOC::Registry->new()->DESTROY(); throws_ok { $conf->read(q{ }); } 'IOC::ConfigurationError', '... got the error we expected'; IOC::Registry->new()->DESTROY(); throws_ok { $conf->read(q{ }); } 'IOC::ConfigurationError', '... got the error we expected'; IOC::Registry->new()->DESTROY(); throws_ok { $conf->read(q{ }); } 'IOC::ConfigurationError', '... got the error we expected'; IOC::Registry->new()->DESTROY(); }