14 isa => sub { die 'not int' unless $_[0] =~ /^\d$/ },
19 isa => quote_sub(q{ die 'not int' unless $_[0] =~ /^\d$/ }),
29 has off_by_one => (is => 'rw', coerce => sub { $_[0] + 1 });
41 __PACKAGE__->meta->make_immutable;
45 Bar->new(frooh => 1, frew => 1);
46 } 'creation of valid Bar';
49 Bar->new(frooh => 'silly', frew => 1);
50 } 'creation of invalid Bar validated by coderef';
53 Bar->new(frooh => 1, frew => 'goose');
54 } 'creation of invalid Bar validated by quoted sub';
57 my ($class, $type) = @_;
59 my $obo = $class->new(off_by_one => 1);
61 is($obo->off_by_one, 2, "Off by one (new) ($type)");
65 is($obo->off_by_one, 42, "Off by one (set) ($type)");
68 test_off_by_one('Baz', 'Moo');
69 test_off_by_one('Quux', 'Moose');