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