File: 01-basic.t

package info (click to toggle)
libextutils-cbuilder-perl 0.23-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 168 kB
  • ctags: 84
  • sloc: perl: 1,079; makefile: 8
file content (68 lines) | stat: -rw-r--r-- 1,423 bytes parent folder | download
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
58
59
60
61
62
63
64
65
66
67
68
#! perl -w

BEGIN {
  if ($ENV{PERL_CORE}) {
    chdir 't' if -d 't';
    chdir '../lib/ExtUtils/CBuilder'
      or die "Can't chdir to lib/ExtUtils/CBuilder: $!";
    @INC = qw(../..);
  }
}

use strict;
use Test;
BEGIN { plan tests => 11 }

use ExtUtils::CBuilder;
use File::Spec;
ok 1;

# TEST doesn't like extraneous output
my $quiet = $ENV{PERL_CORE} && !$ENV{HARNESS_ACTIVE};

my $b = ExtUtils::CBuilder->new(quiet => $quiet);
ok $b;

ok $b->have_compiler;

my $source_file = File::Spec->catfile('t', 'compilet.c');
{
  local *FH;
  open FH, "> $source_file" or die "Can't create $source_file: $!";
  print FH "int boot_compilet(void) { return 1; }\n";
  close FH;
}
ok -e $source_file;

my $object_file = $b->object_file($source_file);
ok 1;

ok $object_file, $b->compile(source => $source_file);

my $lib_file = $b->lib_file($object_file);
ok 1;

my ($lib, @temps) = $b->link(objects => $object_file,
                             module_name => 'compilet');
$lib =~ tr/"'//d;
ok $lib_file, $lib;

for ($source_file, $object_file, $lib_file) {
  tr/"'//d;
  1 while unlink;
}

my @words = $b->split_like_shell(' foo bar');

skip(
    $^O =~ m/MSWin/ ? "Skip under MSWindows" : 0,  # whether to skip
    @words, 2
  );
skip(
    $^O =~ m/MSWin/ ? "Skip under MSWindows" : 0,  # whether to skip
    $words[0], 'foo'
);
skip(
    $^O =~ m/MSWin/ ? "Skip under MSWindows" : 0,  # whether to skip
    $words[1], 'bar'
);