1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
=pod
=encoding utf-8
=head1 PURPOSE
Tests L<Types::Common>.
=head1 AUTHOR
Toby Inkster.
=head1 COPYRIGHT AND LICENCE
This software is copyright (c) 2022-2023 by Toby Inkster.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
use strict;
use warnings FATAL => 'all';
use Test::More;
{
my %imported;
use Types::Common { into => \%imported }, -all;
my @libs = qw(
Types::Standard
Types::Common::Numeric
Types::Common::String
Types::TypeTiny
);
my @types = map $_->type_names, @libs;
my @coercions = map $_->coercion_names, @libs;
is_deeply(
[ sort keys %imported ],
[ sort { $a cmp $b } (
@types,
map( "assert_$_", @types ),
map( "is_$_", @types ),
map( "to_$_", @types ),
@coercions,
@{ $Type::Params::EXPORT_TAGS{sigs} || [] },
qw( t ),
) ],
'correct imports',
);
ok( $imported{t}->( 'Str' ) == Types::Standard::Str(), 't() is preloaded' );
}
done_testing;
|