xref: /onnv-gate/usr/src/cmd/perl/5.8.4/distrib/lib/ExtUtils/t/testlib.t (revision 0:68f95e015346)
1*0Sstevel@tonic-gate#!/usr/bin/perl -Tw
2*0Sstevel@tonic-gate
3*0Sstevel@tonic-gateBEGIN {
4*0Sstevel@tonic-gate    if( $ENV{PERL_CORE} ) {
5*0Sstevel@tonic-gate        chdir 't' if -d 't';
6*0Sstevel@tonic-gate        @INC = '../lib';
7*0Sstevel@tonic-gate    }
8*0Sstevel@tonic-gate    else {
9*0Sstevel@tonic-gate        # ./lib is there so t/lib can be seen even after we chdir.
10*0Sstevel@tonic-gate        unshift @INC, 't/lib', './lib';
11*0Sstevel@tonic-gate    }
12*0Sstevel@tonic-gate}
13*0Sstevel@tonic-gatechdir 't';
14*0Sstevel@tonic-gate
15*0Sstevel@tonic-gateuse Test::More tests => 5;
16*0Sstevel@tonic-gate
17*0Sstevel@tonic-gateBEGIN {
18*0Sstevel@tonic-gate    # non-core tests will have blib in their path.  We remove it
19*0Sstevel@tonic-gate    # and just use the one in lib/.
20*0Sstevel@tonic-gate    unless( $ENV{PERL_CORE} ) {
21*0Sstevel@tonic-gate        @INC = grep !/blib/, @INC;
22*0Sstevel@tonic-gate        unshift @INC, '../lib';
23*0Sstevel@tonic-gate    }
24*0Sstevel@tonic-gate}
25*0Sstevel@tonic-gate
26*0Sstevel@tonic-gatemy @blib_paths = grep /blib/, @INC;
27*0Sstevel@tonic-gateis( @blib_paths, 0, 'No blib dirs yet in @INC' );
28*0Sstevel@tonic-gate
29*0Sstevel@tonic-gateuse_ok( 'ExtUtils::testlib' );
30*0Sstevel@tonic-gate
31*0Sstevel@tonic-gate@blib_paths = grep { /blib/ } @INC;
32*0Sstevel@tonic-gateis( @blib_paths, 2, 'ExtUtils::testlib added two @INC dirs!' );
33*0Sstevel@tonic-gateok( !(grep !File::Spec->file_name_is_absolute($_), @blib_paths),
34*0Sstevel@tonic-gate                    '  and theyre absolute');
35*0Sstevel@tonic-gate
36*0Sstevel@tonic-gateeval { eval "# @INC"; };
37*0Sstevel@tonic-gateis( $@, '',     '@INC is not tainted' );
38