1#! perl -w 2 3use File::Spec; 4my $perl; 5BEGIN { 6 $perl = File::Spec->rel2abs($^X); 7} 8 9use strict; 10use Test::More; 11BEGIN { 12 if ($^O eq 'VMS') { 13 # So we can get the return value of system() 14 require vmsish; 15 import vmsish; 16 } 17} 18 19plan tests => 7; 20 21require_ok "ExtUtils::CBuilder"; 22 23my $b = eval { ExtUtils::CBuilder->new(quiet => 1) }; 24ok( $b, "got CBuilder object" ) or diag $@; 25 26my $bogus_path = 'djaadjfkadjkfajdf'; 27my $run_perl = "$perl -e1 --"; 28# test missing compiler 29$b->{config}{cc} = $bogus_path; 30$b->{config}{ld} = $bogus_path; 31 32$b->{have_cc} = undef; 33is( $b->have_compiler, 0, "have_compiler: fake missing cc" ); 34$b->{have_cxx} = undef; 35is( $b->have_cplusplus, 0, "have_cplusplus: fake missing c++" ); 36 37# test found compiler 38$b->{config}{cc} = $run_perl; 39$b->{config}{ld} = $run_perl; 40$b->{config}{cxx} = $run_perl; 41$b->{have_cc} = undef; 42is( $b->have_compiler, 1, "have_compiler: fake present cc" ); 43$b->{have_cxx} = undef; 44is( $b->have_cplusplus, 1, "have_cpp_compiler: fake present c++" ); 45 46# test missing cpp compiler 47 48# test one non-exported subroutine 49{ 50 my $type = ExtUtils::CBuilder::os_type(); 51 if ($type) { 52 pass( "OS type $type located for $^O" ); 53 } 54 else { 55 pass( "OS type not yet listed for $^O" ); 56 } 57} 58