xref: /openbsd/gnu/usr.bin/perl/cpan/parent/t/parent-pmc.t (revision d415bd75)
1#!/usr/bin/perl -w
2BEGIN {
3    if( $ENV{PERL_CORE} ) {
4        chdir 't' if -d 't';
5        chdir '../lib/parent';
6        @INC = '..';
7    }
8}
9
10use strict;
11use Test::More;
12use Config;
13use lib 't/lib';
14
15plan skip_all => ".pmc are only available with 5.6 and later" if $] < 5.006;
16
17# Skip this test if perl is compiled with PERL_DISABLE_PMC
18#
19my $pmc = 1;
20if (Config->can('non_bincompat_options')) { # $] ge '5.014'
21    $pmc = 0
22        if grep { $_ eq 'PERL_DISABLE_PMC' } Config::non_bincompat_options();
23} elsif (eval {
24    require Config::Perl::V;
25    Config::Perl::V->VERSION('0.10');
26}) {
27    $pmc = 0
28        if Config::Perl::V::myconfig()->{options}{PERL_DISABLE_PMC};
29} else {
30    $pmc = 0
31        if $Config::Config{ccflags} =~ /(?:^|\s)-DPERL_DISABLE_PMC\b/;
32}
33
34plan skip_all => 'Perl is built with PERL_DISABLE_PMC' unless $pmc;
35
36plan tests => 3;
37
38our $got_here;
39
40my $res = eval q{
41    package MyTest;
42
43    use parent 'FileThatOnlyExistsAsPMC';
44
45    1
46};
47my $error = $@;
48
49is $res, 1, "Block ran until the end";
50is $error, '', "No error";
51
52my $obj = bless {}, 'FileThatOnlyExistsAsPMC';
53can_ok $obj, 'exclaim';
54