File: 00-have-compiler.t

package info (click to toggle)
libextutils-cbuilder-perl 0.280205-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 224 kB
  • sloc: perl: 1,718; makefile: 2
file content (57 lines) | stat: -rw-r--r-- 1,267 bytes parent folder | download | duplicates (2)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#! perl -w

use File::Spec;
my $perl;
BEGIN {
  $perl = File::Spec->rel2abs($^X);
}

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 => 7;

require_ok "ExtUtils::CBuilder";

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

my $bogus_path = 'djaadjfkadjkfajdf';
my $run_perl = "$perl -e1 --";
# test missing compiler
$b->{config}{cc} = $bogus_path;
$b->{config}{ld} = $bogus_path;

$b->{have_cc} = undef;
is( $b->have_compiler, 0, "have_compiler: fake missing cc" );
$b->{have_cxx} = undef;
is( $b->have_cplusplus, 0, "have_cplusplus: fake missing c++" );

# test found compiler
$b->{config}{cc} = $run_perl;
$b->{config}{ld} = $run_perl;
$b->{config}{cxx} = $run_perl;
$b->{have_cc} = undef;
is( $b->have_compiler, 1, "have_compiler: fake present cc" );
$b->{have_cxx} = undef;
is( $b->have_cplusplus, 1, "have_cpp_compiler: fake present c++" );

# test missing cpp compiler

# test one non-exported subroutine
{
    my $type = ExtUtils::CBuilder::os_type();
    if ($type) {
        pass( "OS type $type located for $^O" );
    }
    else {
        pass( "OS type not yet listed for $^O" );
    }
}