summaryrefslogtreecommitdiff
path: root/cpan/ExtUtils-CBuilder/t/00-have-compiler.t
blob: cf62e97f2f5b7c3e90fca50e3c835f098f90e419 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#! perl -w

use File::Spec;
my $perl;
BEGIN {
  $perl = File::Spec->rel2abs($^X);
  if ($ENV{PERL_CORE}) {
    chdir 't' if -d 't';
    chdir '../lib/ExtUtils/CBuilder'
      or die "Can't chdir to lib/ExtUtils/CBuilder: $!";
    @INC = qw(../..);
  }
}

use strict;
use Test::More;
BEGIN { 
  if ($^O eq 'VMS') {
    # So we can get the return value of system()
    require vmsish;
    import vmsish;
  }
}

plan tests => 4;

require_ok "ExtUtils::CBuilder";

my $b = eval { ExtUtils::CBuilder->new(quiet => 1) };
ok( $b, "got CBuilder object" ) or diag $@;

# test missing compiler
$b->{config}{cc} = 'djaadjfkadjkfajdf';
$b->{config}{ld} = 'djaadjfkadjkfajdf';
is( $b->have_compiler, 0, "have_compiler: fake missing cc" );

# test found compiler
$b->{have_compiler} = undef;
$b->{config}{cc} = "$perl -e1 --";
$b->{config}{ld} = "$perl -e1 --";
is( $b->have_compiler, 1, "have_compiler: fake present cc" );