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