| 1 |
use strict; |
| 2 |
use warnings; |
| 3 |
|
| 4 |
use File::LibMagic; |
| 5 |
use File::LibMagic::Constants qw( constants ); |
| 6 |
use List::Util qw ( max ); |
| 7 |
|
| 8 |
use Test::More; |
| 9 |
|
| 10 |
my %keys |
| 11 |
= map { $_ => File::LibMagic->$_() } grep {/^MAGIC_PARAM/} constants(); |
| 12 |
my $max = max values %keys; |
| 13 |
|
| 14 |
# We can only assume these tests will pass on machines where we do the entire |
| 15 |
# build from scratch using a version of libmagic that supports all the |
| 16 |
# documented keys. That way we know that the constants match what's defined by |
| 17 |
# the machine's magic.h. |
| 18 |
|
| 19 |
is( |
| 20 |
File::LibMagic->max_param_constant, |
| 21 |
$max, |
| 22 |
'max_param_constant matches the max constant we know about', |
| 23 |
); |
| 24 |
|
| 25 |
## no critic (Subroutines::ProtectPrivateSubs) |
| 26 |
for my $p ( File::LibMagic->_all_limit_params ) { |
| 27 |
ok( |
| 28 |
File::LibMagic->limit_key_is_supported($p), |
| 29 |
"$p limit is supported", |
| 30 |
); |
| 31 |
} |
| 32 |
|
| 33 |
done_testing(); |