Skip to content

Commit

Permalink
ws
Browse files Browse the repository at this point in the history
  • Loading branch information
tobyink committed Nov 17, 2019
1 parent 650ad92 commit 7920319
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 28 deletions.
2 changes: 1 addition & 1 deletion lib/Type/Tiny.pm
Expand Up @@ -921,7 +921,7 @@ sub is_parameterized
# but only if all the parameters are strings or type constraints.
%seen = ();
my $key = $self->____make_key(@_);
undef($key) if $key =~ /____CANNOT_KEY____/;
undef($key) if $key =~ /____CANNOT_KEY____/;
return $param_cache{$key} if defined $key && defined $param_cache{$key};

local $Type::Tiny::parameterize_type = $self;
Expand Down
2 changes: 1 addition & 1 deletion lib/Type/Tiny/Role.pm
Expand Up @@ -24,7 +24,7 @@ my %cache;
sub new {
my $proto = shift;
my %opts = (@_==1) ? %{$_[0]} : @_;
_croak "Need to supply role name" unless exists $opts{role};
_croak "Need to supply role name" unless exists $opts{role};
return $proto->SUPER::new(%opts);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Types/Standard.pm
Expand Up @@ -53,7 +53,7 @@ BEGIN {

*_USE_RUXS = !_AVOID_CALLBACKS() && eval { require Ref::Util::XS; Ref::Util::XS::->VERSION(0.100); 1; }
? sub () { !!1 }
: sub () { !!0 };
: sub () { !!0 };
};


Expand Down
4 changes: 2 additions & 2 deletions t/30-integration/Specio/basic.t
Expand Up @@ -39,7 +39,7 @@ ok $Int->can_be_inlined;

my $check_x = $Int->inline_check('$x');

ok do { my $x = '4'; eval $check_x };
ok do { my $x = '4.1'; !eval $check_x };
ok do { my $x = '4'; eval $check_x };
ok do { my $x = '4.1'; !eval $check_x };

done_testing;
42 changes: 19 additions & 23 deletions t/40-regression/rt104154.t
Expand Up @@ -3,32 +3,28 @@ use warnings;
use Type::Tiny;
use Test::More;

my $type_without = "Type::Tiny"->new
(
name => "HasParam_without",
message => sub { "$_ ain't got a number" },
constraint_generator => sub { sub { 0 } }, # Reject everything
deep_explanation => sub { ["love to contradict"] },
my $type_without = "Type::Tiny"->new(
name => "HasParam_without",
message => sub { "$_ ain't got a number" },
constraint_generator => sub { sub { 0 } }, # Reject everything
deep_explanation => sub { ["love to contradict"] },
);

my $type_with = "Type::Tiny"->new
(
constraint => sub { 1 }, # Un-parameterized accepts al
name => "HasParam_with",
message => sub { "$_ ain't got a number" },
constraint_generator => sub { sub { 0 } }, # Reject everything
deep_explanation => sub { ["love to contradict"] },
my $type_with = "Type::Tiny"->new(
constraint => sub { 1 }, # Un-parameterized accepts al
name => "HasParam_with",
message => sub { "$_ ain't got a number" },
constraint_generator => sub { sub { 0 } }, # Reject everything
deep_explanation => sub { ["love to contradict"] },
);

my $type_parent = "Type::Tiny"->new
(
parent => $type_without,
name => "HasParam_parent",
message => sub { "$_ ain't got a number" },
constraint_generator => sub { sub { 0 } }, # Reject everything
deep_explanation => sub { ["love to contradict"] },
);

my $type_parent = "Type::Tiny"->new(
parent => $type_without,
name => "HasParam_parent",
message => sub { "$_ ain't got a number" },
constraint_generator => sub { sub { 0 } }, # Reject everything
deep_explanation => sub { ["love to contradict"] },
);

my $s = 'a string';
my $param_with = $type_with->parameterize('an ignored parameter');
Expand All @@ -50,4 +46,4 @@ $explain_without =~ s/(HasParam)_\w+/$1/g;
ok $explain_with eq $explain_without;
ok $explain_parent eq $explain_without;

done_testing;
done_testing;

0 comments on commit 7920319

Please sign in to comment.