File: 05defines_to.t

package info (click to toggle)
libextutils-cchecker-perl 0.12-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 180 kB
  • sloc: perl: 343; makefile: 2
file content (31 lines) | stat: -rw-r--r-- 692 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
#!/usr/bin/perl

use v5.14;
use warnings;

use Test2::V0;

use ExtUtils::CChecker;

my $cc = ExtUtils::CChecker->new(
   defines_to => "test-config.h",
);

END { -e "test-config.h" and unlink "test-config.h"; }

ok( defined $cc, 'defined $cc' );
isa_ok( $cc, [ "ExtUtils::CChecker" ], '$cc' );

$cc->try_compile_run(
   source => "int main(void) { return 0; }\n",
   define => "HAVE_C",
);

is( $cc->extra_compiler_flags, [], 'extra_compiler_flags does not have -D' );

ok( -e "test-config.h", 'test-config.h exists' );

open my $fh, "<", "test-config.h" or die "Cannot read test-config.h - $!";
is( scalar <$fh>, "#define HAVE_C /**/\n", 'test-config.h has #define HAVE_C' );

done_testing;