Skip to content

Commit

Permalink
Type::Utils shouldn't export 'is' as part of '-all' because there are…
Browse files Browse the repository at this point in the history
… too many test scripts on CPAN that import '-all' from Type::Utils which will conflict with Test::More
  • Loading branch information
tobyink committed Sep 22, 2020
1 parent 4a42627 commit 3f7b066
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
12 changes: 11 additions & 1 deletion lib/Type/Utils.pm
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,15 @@ our @EXPORT_OK = (
extends type subtype
match_on_type compile_match_on_type
dwim_type english_list
classifier is
classifier
>,
"is",
);
our %EXPORT_TAGS = (
default => \@EXPORT,
all => \@EXPORT_OK,
);
pop @{$EXPORT_TAGS{all}}; # remove 'is'

require Exporter::Tiny;
our @ISA = 'Exporter::Tiny';
Expand Down Expand Up @@ -1101,6 +1107,10 @@ Shortcut for C<< $type->check($value) >> but also if $type is a string,
will look it up via C<dwim_type>.
This function is not exported by default.
This function is not even exported by C<< use Type::Utils -all >>.
You must request it explicitly.
use Type::Utils "is";
Beware using this in test scripts because it has the same name as a function
exported by L<Test::More>. Note that you can rename this function if
Expand Down
2 changes: 1 addition & 1 deletion t/20-unit/Type-Utils/warnings.t
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use Test::Requires { 'Test::Warnings' => 0.005 }; #warnings added in this versio
use Test::Warnings qw( :no_end_test warnings );

use Type::Library -base, -declare => qw/WholeNumber/;
use Type::Utils qw/ -all !is /;
use Type::Utils -all;
use Types::Standard qw/Int/;

my @warnings = warnings {
Expand Down
2 changes: 1 addition & 1 deletion t/40-regression/rt92571.t
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use Test::More;

use Type::Library -base, -declare => qw[ ArrayRefFromAny ];
use Types::Standard -all;
use Type::Utils qw( -all !is );
use Type::Utils -all;

declare_coercion ArrayRefFromAny,
to_type ArrayRef,
Expand Down

0 comments on commit 3f7b066

Please sign in to comment.