Skip to content

Commit

Permalink
Added some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Leont committed Mar 27, 2011
1 parent a4a31be commit 8ce1b3f
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions t/basics.t
@@ -0,0 +1,44 @@
#!/usr/bin/perl -w

use strict;
use warnings FATAL => 'all';
use Test::More tests => 10;

use Config;

use ExtUtils::Config;

is(ExtUtils::Config->get('config_args'), $Config{config_args}, "'config_args' is the same for ExtUtils::Config");

my $config = ExtUtils::Config->new;

is($config->get('config_args'), $Config{config_args}, "'config_args' is the same for \$config");

ok(!defined $config->get('nonexistent'), "'nonexistent' is nonexistent");

is_deeply($config->all_config, \%Config, 'all_config is \%Config');

{
my %myconfig = %Config;
$config->set('more', 'nomore');
$myconfig{more} = 'nomore';

is_deeply($config->values_set, { more => 'nomore' }, 'values_set is { more => \'nomore\'}');

is_deeply($config->all_config, \%myconfig, 'allconfig is myconfig');
}

$config->pop('more');

is_deeply($config->all_config, \%Config, 'all_config is \%Config again');

$config->push('more', 'more1');
$config->push('more', 'more2');

is($config->get('more'), 'more2', "'more' is now 'more2");
$config->pop('more');
is($config->get('more'), 'more1', "'more' is now 'more1");

my $config2 = ExtUtils::Config->new(values => { more => 'more3'});

is_deeply($config2->values_set, { more => 'more3' }, "\$config2 has 'more' set to 'more3'");

0 comments on commit 8ce1b3f

Please sign in to comment.