Lines 18-29
use_ok('File::MimeInfo', qw/mimetype describe globs/); # 1
Link Here
|
18 |
|
18 |
|
19 |
# test _glob_to_regexp |
19 |
# test _glob_to_regexp |
20 |
my $i = 0; |
20 |
my $i = 0; |
21 |
for ( |
21 |
for my $glob ( |
22 |
[ '*.pl', '(?-xism:^.*\.pl$)' ], # 4 |
22 |
[ '*.pl', [ '(?-xism:^.*\.pl$)', '(?^u:^.*\.pl$)' ] ], # 4 |
23 |
[ '*.h++', '(?-xism:^.*\.h\+\+$)' ], # 5 |
23 |
[ '*.h++', [ '(?-xism:^.*\.h\+\+$)', '(?^u:^.*\.h\+\+$)' ] ], # 5 |
24 |
[ '*.[tar].*', '(?-xism:^.*\.[tar]\..*$)'], # 6 |
24 |
[ '*.[tar].*', [ '(?-xism:^.*\.[tar]\..*$)', '(?^u:^.*\.[tar]\..*$)' ] ], # 6 |
25 |
[ '*.?', '(?-xism:^.*\..?$)'], # 7 |
25 |
[ '*.?', [ '(?-xism:^.*\..?$)', '(?^u:^.*\..?$)' ] ], # 7 |
26 |
) { is( File::MimeInfo::_glob_to_regexp($_->[0]), $_->[1], 'glob '.++$i ) } |
26 |
) |
|
|
27 |
{ |
28 |
my $converted = File::MimeInfo::_glob_to_regexp( $glob->[0] ); |
29 |
my $number = ++$i; |
30 |
if ( my ($match) = grep { $_ eq "$converted" } @{ $glob->[1] } ) { |
31 |
pass( 'glob ' . $number . ' matches an expected value' ); |
32 |
note explain $match; |
33 |
next; |
34 |
} |
35 |
fail( 'glob ' . $number . ' matches an expected value' ); |
36 |
diag explain { got => "$converted", expected_one_of => $glob->[1] }; |
37 |
} |
27 |
|
38 |
|
28 |
# test parsing file names |
39 |
# test parsing file names |
29 |
$i = 0; |
40 |
$i = 0; |
30 |
- |
|
|