This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Sync ExtUtils-CBuilder test scripts with CPAN versions
[perl5.git] / cpan / ExtUtils-CBuilder / t / 00-have-compiler.t
CommitLineData
9015f106
DG
1#! perl -w
2
9ef43512
DG
3use File::Spec;
4my $perl;
9015f106 5BEGIN {
9ef43512 6 $perl = File::Spec->rel2abs($^X);
1579b025
SH
7 if ($ENV{PERL_CORE}) {
8 chdir 't' if -d 't';
9 chdir '../lib/ExtUtils/CBuilder'
10 or die "Can't chdir to lib/ExtUtils/CBuilder: $!";
11 @INC = qw(../..);
12 }
9015f106
DG
13}
14
15use strict;
16use Test::More;
9015f106
DG
17BEGIN {
18 if ($^O eq 'VMS') {
19 # So we can get the return value of system()
20 require vmsish;
21 import vmsish;
22 }
23}
24
25plan tests => 4;
26
27require_ok "ExtUtils::CBuilder";
28
29my $b = eval { ExtUtils::CBuilder->new(quiet => 1) };
30ok( $b, "got CBuilder object" ) or diag $@;
31
32# test missing compiler
33$b->{config}{cc} = 'djaadjfkadjkfajdf';
34$b->{config}{ld} = 'djaadjfkadjkfajdf';
35is( $b->have_compiler, 0, "have_compiler: fake missing cc" );
36
37# test found compiler
38$b->{have_compiler} = undef;
9ef43512
DG
39$b->{config}{cc} = "$perl -e1 --";
40$b->{config}{ld} = "$perl -e1 --";
9015f106
DG
41is( $b->have_compiler, 1, "have_compiler: fake present cc" );
42
43