4 if( $ENV{PERL_CORE} ) {
14 if ($^O =~ /cygwin/i) {
17 plan skip_all => "This is not cygwin";
24 # MM package faked up by messy MI entanglement
25 @MM::ISA = qw( ExtUtils::MM_Unix ExtUtils::Liblist::Kid ExtUtils::MakeMaker );
27 use_ok( 'ExtUtils::MM_Cygwin' );
30 my $path = File::Spec->canonpath('/a/../../c');
31 is( MM->canonpath('/a/../../c'), $path,
32 'canonpath() method should work just like the one in File::Spec' );
34 # test cflags, with the fake package below
36 CFLAGS => 'fakeflags',
40 # with CFLAGS set, it should be returned
41 is( $args->cflags(), 'fakeflags',
42 'cflags() should return CFLAGS member data, if set' );
44 delete $args->{CFLAGS};
46 # ExtUtils::MM_Cygwin::cflags() calls this, fake the output
47 *ExtUtils::MM_Unix::cflags = sub { return $_[1] };
49 # respects the config setting, should ignore whitespace around equal sign
50 my $ccflags = $Config{useshrplib} eq 'true' ? ' -DUSEIMPORTLIB' : '';
51 $args->cflags(<<FLAGS);
58 like( $args->{CFLAGS}, qr/OPTIMIZE = opt/, '... should set OPTIMIZE' );
59 like( $args->{CFLAGS}, qr/PERLTYPE = pt/, '... should set PERLTYPE' );
60 like( $args->{CFLAGS}, qr/LARGE = lg/, '... should set LARGE' );
61 like( $args->{CFLAGS}, qr/SPLIT = split/, '... should set SPLIT' );
62 like( $args->{CFLAGS}, qr/CCFLAGS = $ccflags/, '... should set CCFLAGS' );
70 like( $args->manifypods(), qr/pure_all\n\tnoecho/,
71 'manifypods() should return without PODS values set' );
73 $args->{MAN3PODS} = { foo => 1 };
74 my $out = tie *STDOUT, 'FakeOut';
76 local *MM::perl_script = sub { return };
77 my $res = $args->manifypods();
78 like( $$out, qr/could not locate your pod2man/,
79 '... should warn if pod2man cannot be located' );
80 like( $res, qr/POD2MAN_EXE = -S pod2man/,
81 '... should use default pod2man target' );
82 like( $res, qr/pure_all.+foo/, '... should add MAN3PODS targets' );
84 $args->{PERL_SRC} = File::Spec->updir;
85 $args->{MAN1PODS} = { bar => 1 };
87 $res = $args->manifypods();
88 is( $$out, '', '... should not warn if PERL_SRC provided' );
89 like( $res, qr/bar \\\n\t1 \\\n\tfoo/, '... should join MAN1PODS and MAN3PODS');
92 my $libperl = $Config{libperl} || 'libperl.a';
93 is( $args->perl_archive(), "\$(PERL_INC)/$libperl",
94 'perl_archive() should respect libperl setting' );
96 # test import of $Verbose and &neatvalue
97 can_ok( 'ExtUtils::MM_Cygwin', 'neatvalue' );
98 is( $ExtUtils::MM_Cygwin::Verbose, $ExtUtils::MakeMaker::Verbose,
99 'ExtUtils::MM_Cygwin should import $Verbose from ExtUtils::MakeMaker' );
104 bless(\(my $scalar), $_[0]);