| 1 |
#!/usr/bin/perl |
| 2 |
use strict; |
| 3 |
use warnings; |
| 4 |
use Test::More tests => 3; |
| 5 |
use ExtUtils::ParseXS::Utilities qw( |
| 6 |
standard_typemap_locations |
| 7 |
); |
| 8 |
|
| 9 |
{ |
| 10 |
local @INC = @INC; |
| 11 |
my @stl = standard_typemap_locations( \@INC ); |
| 12 |
ok( @stl >= 9, "At least 9 entries in typemap locations list" ); |
| 13 |
is( $stl[$#stl], 'typemap', |
| 14 |
"Last element is typemap in current directory"); |
| 15 |
SKIP: { |
| 16 |
skip "No lib/ExtUtils/ directories under directories in \@INC", |
| 17 |
1 |
| 18 |
unless @stl > 9; |
| 19 |
|
| 20 |
# We check only as many location entries from the start of the array |
| 21 |
# (where the @INC-related entries are) as there are entries from @INC. |
| 22 |
# We manage to do that by stopping when we find the "updir" related |
| 23 |
# entries, which we assume is never contained in a default @INC entry. |
| 24 |
my $updir = File::Spec->updir; |
| 25 |
my $max = $#INC; |
| 26 |
$max = $#stl if $#stl < $max; |
| 27 |
foreach my $i (0.. $max) { |
| 28 |
$max = $i, last if $stl[$i] =~ /\Q$updir\E/; |
| 29 |
} |
| 30 |
|
| 31 |
ok( |
| 32 |
( 0 < (grep -f $_, @stl[0..$max]) ), |
| 33 |
"At least one typemap file exists underneath \@INC directories" |
| 34 |
); |
| 35 |
} |
| 36 |
} |
| 37 |
|