xref: /onnv-gate/usr/src/cmd/perl/5.8.4/distrib/lib/ExtUtils/t/prefixify.t (revision 0:68f95e015346)
1*0Sstevel@tonic-gate#!/usr/bin/perl -w
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', 'lib');
7*0Sstevel@tonic-gate    }
8*0Sstevel@tonic-gate    else {
9*0Sstevel@tonic-gate        unshift @INC, 't/lib';
10*0Sstevel@tonic-gate    }
11*0Sstevel@tonic-gate}
12*0Sstevel@tonic-gate
13*0Sstevel@tonic-gateuse strict;
14*0Sstevel@tonic-gateuse Test::More;
15*0Sstevel@tonic-gate
16*0Sstevel@tonic-gateif( $^O eq 'VMS' ) {
17*0Sstevel@tonic-gate    plan skip_all => 'prefixify works differently on VMS';
18*0Sstevel@tonic-gate}
19*0Sstevel@tonic-gateelse {
20*0Sstevel@tonic-gate    plan tests => 3;
21*0Sstevel@tonic-gate}
22*0Sstevel@tonic-gateuse Config;
23*0Sstevel@tonic-gateuse File::Spec;
24*0Sstevel@tonic-gateuse ExtUtils::MM;
25*0Sstevel@tonic-gate
26*0Sstevel@tonic-gatemy $mm = bless {}, 'MM';
27*0Sstevel@tonic-gate
28*0Sstevel@tonic-gatemy $default = File::Spec->catdir(qw(this that));
29*0Sstevel@tonic-gate
30*0Sstevel@tonic-gate$mm->prefixify('installbin', 'wibble', 'something', $default);
31*0Sstevel@tonic-gateis( $mm->{INSTALLBIN}, $Config{installbin},
32*0Sstevel@tonic-gate                                            'prefixify w/defaults');
33*0Sstevel@tonic-gate
34*0Sstevel@tonic-gate$mm->{ARGS}{PREFIX} = 'foo';
35*0Sstevel@tonic-gate$mm->prefixify('installbin', 'wibble', 'something', $default);
36*0Sstevel@tonic-gateis( $mm->{INSTALLBIN}, File::Spec->catdir('something', $default),
37*0Sstevel@tonic-gate                                            'prefixify w/defaults and PREFIX');
38*0Sstevel@tonic-gate
39*0Sstevel@tonic-gate{
40*0Sstevel@tonic-gate    undef *ExtUtils::MM_Unix::Config;
41*0Sstevel@tonic-gate    $ExtUtils::MM_Unix::Config{wibble} = 'C:\opt\perl\wibble';
42*0Sstevel@tonic-gate    $mm->prefixify('wibble', 'C:\opt\perl', 'C:\yarrow');
43*0Sstevel@tonic-gate
44*0Sstevel@tonic-gate    is( $mm->{WIBBLE}, 'C:\yarrow\wibble',  'prefixify Win32 paths' );
45*0Sstevel@tonic-gate    { package ExtUtils::MM_Unix;  Config->import }
46*0Sstevel@tonic-gate}
47