| 1 |
use strict; |
| 2 |
use warnings; |
| 3 |
|
| 4 |
use lib 't/lib'; |
| 5 |
|
| 6 |
use Test::Fatal; |
| 7 |
use Test::MaxMind::DB::Common::Data qw( test_cases_for ); |
| 8 |
use Test::MaxMind::DB::Writer::Serializer qw( test_encoding_of_type ); |
| 9 |
use Test::More; |
| 10 |
|
| 11 |
use MaxMind::DB::Writer::Serializer; |
| 12 |
|
| 13 |
test_encoding_of_type( map => test_cases_for('map') ); |
| 14 |
|
| 15 |
{ |
| 16 |
my $serializer = MaxMind::DB::Writer::Serializer->new( |
| 17 |
map_key_type_callback => sub { } ); |
| 18 |
|
| 19 |
like( |
| 20 |
exception { $serializer->_type_for_key('bad key') }, |
| 21 |
qr/\QCould not determine the type for map key "bad key"/, |
| 22 |
'cannot guess the type for an unknown hash key' |
| 23 |
); |
| 24 |
} |
| 25 |
|
| 26 |
done_testing(); |