This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update the comments in t/op/magic.t
[perl5.git] / dist / 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);
9015f106
DG
7}
8
9use strict;
10use Test::More;
9015f106
DG
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
06e8058f 19plan tests => 7;
9015f106
DG
20
21require_ok "ExtUtils::CBuilder";
22
23my $b = eval { ExtUtils::CBuilder->new(quiet => 1) };
24ok( $b, "got CBuilder object" ) or diag $@;
25
506098d4
DG
26my $bogus_path = 'djaadjfkadjkfajdf';
27my $run_perl = "$perl -e1 --";
9015f106 28# test missing compiler
506098d4
DG
29$b->{config}{cc} = $bogus_path;
30$b->{config}{ld} = $bogus_path;
31
06e8058f 32$b->{have_cc} = undef;
9015f106 33is( $b->have_compiler, 0, "have_compiler: fake missing cc" );
06e8058f 34$b->{have_cxx} = undef;
506098d4 35is( $b->have_cplusplus, 0, "have_cplusplus: fake missing c++" );
9015f106
DG
36
37# test found compiler
506098d4
DG
38$b->{config}{cc} = $run_perl;
39$b->{config}{ld} = $run_perl;
06e8058f
CBW
40$b->{config}{cxx} = $run_perl;
41$b->{have_cc} = undef;
9015f106 42is( $b->have_compiler, 1, "have_compiler: fake present cc" );
06e8058f 43$b->{have_cxx} = undef;
506098d4 44is( $b->have_cplusplus, 1, "have_cpp_compiler: fake present c++" );
9015f106 45
506098d4 46# test missing cpp compiler
06e8058f
CBW
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}