Commit | Line | Data |
---|---|---|
9015f106 DG |
1 | #! perl -w |
2 | ||
9ef43512 DG |
3 | use File::Spec; |
4 | my $perl; | |
9015f106 | 5 | BEGIN { |
9ef43512 | 6 | $perl = File::Spec->rel2abs($^X); |
9015f106 DG |
7 | } |
8 | ||
9 | use strict; | |
10 | use Test::More; | |
9015f106 DG |
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 | ||
06e8058f | 19 | plan tests => 7; |
9015f106 DG |
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 | ||
506098d4 DG |
26 | my $bogus_path = 'djaadjfkadjkfajdf'; |
27 | my $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 | 33 | is( $b->have_compiler, 0, "have_compiler: fake missing cc" ); |
06e8058f | 34 | $b->{have_cxx} = undef; |
506098d4 | 35 | is( $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 | 42 | is( $b->have_compiler, 1, "have_compiler: fake present cc" ); |
06e8058f | 43 | $b->{have_cxx} = undef; |
506098d4 | 44 | is( $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 | } |