From: Jarkko Hietaniemi Date: Tue, 23 Apr 2002 01:49:37 +0000 (+0000) Subject: Undo #16091, a time-warped escapee. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6df87cfb5b959d78f0c659ff993288019e735858;p=p5sagit%2Fp5-mst-13.2.git Undo #16091, a time-warped escapee. p4raw-id: //depot/perl@16095 --- diff --git a/lib/ExtUtils/t/MM_Cygwin.t b/lib/ExtUtils/t/MM_Cygwin.t index 4023f33..74aef67 100644 --- a/lib/ExtUtils/t/MM_Cygwin.t +++ b/lib/ExtUtils/t/MM_Cygwin.t @@ -1,25 +1,29 @@ -#!./perl +#!/usr/bin/perl BEGIN { - chdir 't' if -d 't'; - @INC = '../lib'; + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + @INC = '../lib'; + } + else { + unshift @INC, 't/lib'; + } } +chdir 't'; use Test::More; BEGIN { if ($^O =~ /cygwin/i) { - plan tests => 17; + plan tests => 13; } else { - plan skip_all => 'Test irrelevant outside of Cygwin'; + plan skip_all => "This is not cygwin"; } } use Config; use File::Spec; - -# MM package faked up by messy MI entanglement -@MM::ISA = qw( ExtUtils::MM_Unix ExtUtils::Liblist::Kid ExtUtils::MakeMaker ); +use ExtUtils::MM; use_ok( 'ExtUtils::MM_Cygwin' ); @@ -41,21 +45,23 @@ is( $args->cflags(), 'fakeflags', delete $args->{CFLAGS}; # ExtUtils::MM_Cygwin::cflags() calls this, fake the output -*ExtUtils::MM_Unix::cflags = sub { return $_[1] }; +{ + no warnings 'redefine'; + sub ExtUtils::MM_Unix::cflags { return $_[1] }; +} # respects the config setting, should ignore whitespace around equal sign my $ccflags = $Config{useshrplib} eq 'true' ? ' -DUSEIMPORTLIB' : ''; -$args->cflags(<{NEEDS_LINKING} = 1; + $args->cflags(<{CFLAGS}, qr/OPTIMIZE = opt/, '... should set OPTIMIZE' ); like( $args->{CFLAGS}, qr/PERLTYPE = pt/, '... should set PERLTYPE' ); -like( $args->{CFLAGS}, qr/LARGE = lg/, '... should set LARGE' ); -like( $args->{CFLAGS}, qr/SPLIT = split/, '... should set SPLIT' ); like( $args->{CFLAGS}, qr/CCFLAGS = $ccflags/, '... should set CCFLAGS' ); # test manifypods @@ -63,35 +69,41 @@ $args = bless({ NOECHO => 'noecho', MAN3PODS => {}, MAN1PODS => {}, + MAKEFILE => 'Makefile', }, 'MM'); like( $args->manifypods(), qr/pure_all\n\tnoecho/, 'manifypods() should return without PODS values set' ); $args->{MAN3PODS} = { foo => 1 }; my $out = tie *STDOUT, 'FakeOut'; -my $res = $args->manifypods(); -like( $$out, qr/could not locate your pod2man/, - '... should warn if pod2man cannot be located' ); -like( $res, qr/POD2MAN_EXE = -S pod2man/, - '... should use default pod2man target' ); -like( $res, qr/pure_all.+foo/, '... should add MAN3PODS targets' ); - -$args->{PERL_SRC} = File::Spec->updir; -$args->{MAN1PODS} = { bar => 1 }; -$$out = ''; -$res = $args->manifypods(); -is( $$out, '', '... should not warn if PERL_SRC provided' ); -like( $res, qr/bar \\\n\t1 \\\n\tfoo/, '... should join MAN1PODS and MAN3PODS'); +{ + no warnings 'once'; + local *MM::perl_script = sub { return }; + my $res = $args->manifypods(); + like( $$out, qr/could not locate your pod2man/, + '... should warn if pod2man cannot be located' ); + like( $res, qr/POD2MAN_EXE = -S pod2man/, + '... should use default pod2man target' ); + like( $res, qr/pure_all.+foo/, '... should add MAN3PODS targets' ); +} + +SKIP: { + skip "Only relevent in the core", 2 unless $ENV{PERL_CORE}; + $args->{PERL_SRC} = File::Spec->updir; + $args->{MAN1PODS} = { bar => 1 }; + $$out = ''; + $res = $args->manifypods(); + is( $$out, '', '... should not warn if PERL_SRC provided' ); + like( $res, qr/bar \\\n\t1 \\\n\tfoo/, + '... should join MAN1PODS and MAN3PODS'); +} # test perl_archive my $libperl = $Config{libperl} || 'libperl.a'; +$libperl =~ s/\.a/.dll.a/; is( $args->perl_archive(), "\$(PERL_INC)/$libperl", 'perl_archive() should respect libperl setting' ); -# test import of $Verbose and &neatvalue -can_ok( 'ExtUtils::MM_Cygwin', 'neatvalue' ); -is( $ExtUtils::MM_Cygwin::Verbose, $ExtUtils::MakeMaker::Verbose, - 'ExtUtils::MM_Cygwin should import $Verbose from ExtUtils::MakeMaker' ); package FakeOut;