X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F046_rebless_instance.t;h=b1bd4e3fdda8466961a553f78c1ce526efbd2550;hb=871e9eb5d05b8b9986b2de3f4095f65a31159c56;hp=49919d4d45606c5a8598e430a0ce4921115defc3;hpb=13b8971fa6cc4edf7d55a2e5482820d62ba38f16;p=gitmo%2FClass-MOP.git diff --git a/t/046_rebless_instance.t b/t/046_rebless_instance.t index 49919d4..b1bd4e3 100644 --- a/t/046_rebless_instance.t +++ b/t/046_rebless_instance.t @@ -33,7 +33,7 @@ my $foo = Parent->new; is(blessed($foo), 'Parent', 'Parent->new gives a Parent'); is($foo->whoami, "parent", 'Parent->whoami gives parent'); is($foo->parent, "parent", 'Parent->parent gives parent'); -ok exception { $foo->child }, "Parent->child method doesn't exist"; +isnt( exception { $foo->child }, undef, "Parent->child method doesn't exist" ); Child->meta->rebless_instance($foo); is(blessed($foo), 'Child', 'rebless_instance really reblessed the instance'); @@ -41,23 +41,19 @@ is($foo->whoami, "child", 'reblessed->whoami gives child'); is($foo->parent, "parent", 'reblessed->parent gives parent'); is($foo->child, "child", 'reblessed->child gives child'); -like exception { LeftField->meta->rebless_instance($foo) }, - qr/You may rebless only into a subclass of \(Child\), of which \(LeftField\) isn't\./; +like( exception { LeftField->meta->rebless_instance($foo) }, qr/You may rebless only into a subclass of \(Child\), of which \(LeftField\) isn't\./ ); -like exception { Class::MOP::Class->initialize("NonExistent")->rebless_instance($foo) }, - qr/You may rebless only into a subclass of \(Child\), of which \(NonExistent\) isn't\./; +like( exception { Class::MOP::Class->initialize("NonExistent")->rebless_instance($foo) }, qr/You may rebless only into a subclass of \(Child\), of which \(NonExistent\) isn't\./ ); Parent->meta->rebless_instance_back($foo); is(blessed($foo), 'Parent', 'Parent->new gives a Parent'); is($foo->whoami, "parent", 'Parent->whoami gives parent'); is($foo->parent, "parent", 'Parent->parent gives parent'); -ok exception { $foo->child }, "Parent->child method doesn't exist"; +isnt( exception { $foo->child }, undef, "Parent->child method doesn't exist" ); -like exception { LeftField->meta->rebless_instance_back($foo) }, - qr/You may rebless only into a superclass of \(Parent\), of which \(LeftField\) isn't\./; +like( exception { LeftField->meta->rebless_instance_back($foo) }, qr/You may rebless only into a superclass of \(Parent\), of which \(LeftField\) isn't\./ ); -like exception { Class::MOP::Class->initialize("NonExistent")->rebless_instance_back($foo) }, - qr/You may rebless only into a superclass of \(Parent\), of which \(NonExistent\) isn't\./; +like( exception { Class::MOP::Class->initialize("NonExistent")->rebless_instance_back($foo) }, qr/You may rebless only into a superclass of \(Parent\), of which \(NonExistent\) isn't\./ ); # make sure our ->meta is still sane my $bar = Parent->new;