xref: /openbsd-src/gnu/usr.bin/perl/lib/Config/Extensions.t (revision 256a93a44f36679bee503f12e49566c2183f6181)
1850e2753Smillert#!perl -w
2850e2753SmillertBEGIN {
3850e2753Smillert    if( $ENV{PERL_CORE} ) {
4850e2753Smillert        chdir 't' if -d 't';
5850e2753Smillert        @INC = '../lib';
6850e2753Smillert    }
7850e2753Smillert}
8850e2753Smillertuse strict;
9*256a93a4Safresh1use Test::More;
10850e2753Smillert
11850e2753SmillertBEGIN {use_ok 'Config::Extensions', '%Extensions'};
12850e2753Smillert
13850e2753Smillertuse Config;
14850e2753Smillert
15850e2753Smillertmy @types = qw(dynamic static nonxs);
16850e2753Smillertmy %types;
17850e2753Smillert@types{@types} = @types;
18850e2753Smillert
19850e2753Smillertok (keys %Extensions, "There are some extensions");
20850e2753Smillert# Check only the 3 valid keys have been used.
21850e2753Smillertwhile (my ($key, $val) = each %Extensions) {
22850e2753Smillert    my $raw_ext = $key;
23850e2753Smillert    # Back to the format in Config
24850e2753Smillert    $raw_ext =~ s!::!/!g;
25850e2753Smillert    my $re = qr/\b\Q$raw_ext\E\b/;
26850e2753Smillert    like($Config{extensions}, $re, "$key was built");
27850e2753Smillert    unless ($types{$val}) {
28850e2753Smillert	fail("$key is $val");
29850e2753Smillert	next;
30850e2753Smillert    }
31850e2753Smillert    my $type = $val . '_ext';
32850e2753Smillert    like($Config{$type}, $re, "$key is $type");
33850e2753Smillert}
34*256a93a4Safresh1
35*256a93a4Safresh1done_testing();
36