From: Nicholas Clark Date: Mon, 6 Dec 2004 10:35:00 +0000 (+0000) Subject: Check that @INC entries and %Config path entries are consistent. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5b8bd2c68dd56a506776491bc74491670014db96;p=p5sagit%2Fp5-mst-13.2.git Check that @INC entries and %Config path entries are consistent. p4raw-id: //depot/perl@23610 --- diff --git a/lib/Config.t b/lib/Config.t index 63e0f20..a3a5e71 100644 --- a/lib/Config.t +++ b/lib/Config.t @@ -234,3 +234,29 @@ foreach my $pain ($first, @virtual) { "which is the expected result for $pain"); } +# Check that config entries appear correctly in @INC +# TestInit.pm has probably already messed with our @INC +my ($path, $ver, @orig_inc) + = split /\n/, runperl (nolib=>1, prog=>'print qq{$_\n} for $^X, $], @INC'); + +die "This perl is $] at $^X; other perl is $ver (at $path) " + . '- failed to find this perl' unless $] eq $ver; + +my %orig_inc; +@orig_inc{@orig_inc} = (); + +my $failed; +# This is the order that directories are pushed onto @INC in perl.c: +foreach my $lib (qw(applibexp archlibexp privlibexp sitearchexp sitelibexp + vendorarchexp vendorlibexp vendorlib_stem)) { + my $dir = $Config{$lib}; + SKIP: { + skip "lib $lib not defined" unless defined $dir; + skip "lib $lib not set" unless length $dir; + # So we expect to find it in @INC + + ok (exists $orig_inc{$dir}, "Expect $lib '$dir' to be in \@INC") + or $failed++; + } +} +_diag ('@INC is:', @orig_inc) if $failed;