Re: [perl #18888] $Exporter::Verbose=1 does not work for testing, $Heavy::Verbose...
[p5sagit/p5-mst-13.2.git] / lib / Config.t
index c47519b..f13b402 100644 (file)
@@ -1,10 +1,12 @@
+#!./perl
+
 BEGIN {
     chdir 't' if -d 't';
     @INC = '../lib';
     require "./test.pl";
 }
 
-plan tests => 23;
+plan tests => 34;
 
 use_ok('Config');
 
@@ -16,6 +18,16 @@ ok(each %Config);
 
 is($Config{PERL_REVISION}, 5, "PERL_REVISION is 5");
 
+# Check that old config variable names are aliased to their new ones.
+my %grandfathers = ( PERL_VERSION       => 'PATCHLEVEL',
+                     PERL_SUBVERSION    => 'SUBVERSION',
+                     PERL_CONFIG_SH     => 'CONFIG'
+                   );
+while( my($new, $old) = each %grandfathers ) {
+    isnt($Config{$new}, undef,       "$new is defined");
+    is($Config{$new}, $Config{$old}, "$new is aliased to $old");
+}
+
 ok( exists $Config{cc},      "has cc");
 
 ok( exists $Config{ccflags}, "has ccflags");
@@ -40,9 +52,20 @@ ok(exists $Config{ccflags_nolargefiles}, "has ccflags_nolargefiles");
 
 # Utility functions.
 
-like(Config::myconfig(),  qr/cc='$Config{cc}'/, "myconfig");
+{
+    # make sure we can export what we say we can export.
+    package Foo;
+    my @exports = qw(myconfig config_sh config_vars config_re);
+    Config->import(@exports);
+    foreach my $func (@exports) {
+       ::ok( __PACKAGE__->can($func), "$func exported" );
+    }
+}
 
-like(Config::config_sh(), qr/cc='$Config{cc}'/, "config_sh");
+like(Config::myconfig(),       qr/osname=$Config{osname}/,   "myconfig");
+like(Config::config_sh(),      qr/osname='$Config{osname}'/, "config_sh");
+like(join("\n", Config::config_re('c.*')),
+                              qr/^c.*?=/,                   'config_re' );
 
 my $out = tie *STDOUT, 'FakeOut';