t)');
ok(isweak($left_right->{parent}), '... parent is a weakened ref');
# and check the error
isnt(
exception {
$left_right->right($left_left);
},
undef,
'... cannot assign
$callback->("Hello $value World");
},
);
__PACKAGE__->meta->make_immutable;
}
isnt( exception {
Fail::Bar->new(foo => 10)
}, undef, '... this fails, because initializer returns
king_account->balance, 50,
'... got the right checkings balance after withdrawal' );
isnt(
exception {
$checking_account->withdraw(200);
},
undef,
. got the right value');
is( is_acceptable_color( 'black' ), 'CMYK', '... got the right value');
isnt( exception {
is_acceptable_color( 'orange' )
}, undef, '... got the exception' );
## using i
= Foo->new;
isa_ok($foo, 'Foo');
ok(!$bar->can( 'talk' ), "... the role is not composed yet");
isnt( exception {
$foo->dog($bar)
}, undef, '... and setting the accessor fails (not a Dog yet)' )
);
},
q{},
'no warning when replace_destructor is true'
);
::isnt(
$meta->find_method_by_name('new')->body,
HasConstructor2->can('new'),
'H
f the
# prototype
my $foo = Foo->new;
isa_ok($foo, 'Foo');
# the instance is *not* the prototype
isnt($foo, $foo_prototype, '... got a new instance of Foo');
# but it has the same values ...
is($foo
ckage Bling::Bling;
use Moose;
extends 'Bling';
sub bling { 'Bling::bling' }
::isnt( ::exception {
override 'bling' => sub {};
}, undef, '... cannot override a method wh
ARRAY ref of roles/ );
ok !is_class_loaded('Made::Of::Fail'), "did not create Made::Of::Fail";
isnt( exception {
Moose::Meta::Class->create(
'Continuing::To::Fail',
superclasses
ckage Bling::Bling;
use Moose;
extends 'Bling';
sub bling { 'Bling::bling' }
::isnt( ::exception {
augment 'bling' => sub {};
}, undef, '... cannot augment a method whic
t the &meta method');
ok(Foo->isa('Moose::Object'), '... Foo is automagically a Moose::Object');
isnt( exception {
Foo->meta->has_method()
}, undef, '... has_method requires an arg' );
can_ok('Fo
is( exception {
$bar->foo('Foo');
}, undef, '... checked the type constraint correctly' );
isnt( exception {
$bar->foo(Foo->new);
}, undef, '... checked the type constraint correctly' );
d
able" );
is( exception { $meta->identifier }, undef, "->identifier on metaclass lives" );
isnt( exception { $meta->add_role($foo_role) }, undef, "Add Role is locked" );
is( exception { Foo
or');
is($point->x, 2, '... the x attribute was initialized correctly through the metaobject');
isnt( exception {
$point->x(42);
}, undef, '... cannot write to a read-only accessor' );
is($point
ok( $meta->can('mymetaclass_attributes'),
'... meta can do method after immutable' );
isnt( Scalar::Util::blessed( Baz->meta ),
Scalar::Util::blessed( Bar->meta ),
'Baz and
;
is( $savings_account->balance, 200,
'... got the right savings balance after withdrawal' );
isnt( exception {
$savings_account->withdraw(250);
}, undef, '... could not withdraw from savings
'before', [ ['foo', 'bar'], sub { $COUNT++ } ]);
}, undef, 'method modifier with an arrayref' );
isnt( exception {
add_method_modifier('Foo', 'before', [ {'foo' => 'bar'}, sub { $COUNT++ } ]);
},
an int");
}, undef, "... the constructor doesn't care about 'zot' ($mutable_string)" );
isnt( exception {
Foo->new(foo => "Hello World", bar => 100, baz => "Hello World");
}, und
->new },
handles => ['bar']
);
package Goorch::Autoloaded;
use Moose;
::isnt( ::exception {
has 'foo' => (
is => 'rw',
default => sub { F