summaryrefslogtreecommitdiffstats
path: root/t/40-destructor.t
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2010-06-15 03:39:08 -0500
committerJesse Luehrs <doy@tozt.net>2010-06-15 03:39:08 -0500
commitdfc2ff5f2709f198d9fdb21d84a2534acc9f3670 (patch)
tree1e7792b6281cc26c634552d0b3a34ac73653fc62 /t/40-destructor.t
parenteaf8ccad64a0ca7a5f69ce884753a395f4c196fc (diff)
downloadmoosex-nonmoose-dfc2ff5f2709f198d9fdb21d84a2534acc9f3670.tar.gz
moosex-nonmoose-dfc2ff5f2709f198d9fdb21d84a2534acc9f3670.zip
make more tests use with_immutable
Diffstat (limited to 't/40-destructor.t')
-rw-r--r--t/40-destructor.t19
1 files changed, 9 insertions, 10 deletions
diff --git a/t/40-destructor.t b/t/40-destructor.t
index f2c88be..741db60 100644
--- a/t/40-destructor.t
+++ b/t/40-destructor.t
@@ -2,9 +2,9 @@
use strict;
use warnings;
use Test::More tests => 4;
+use Test::Moose;
-my $destroyed = 0;
-my $demolished = 0;
+my ($destroyed, $demolished);
package Foo;
sub new { bless {}, shift }
@@ -19,11 +19,10 @@ extends 'Foo';
sub DEMOLISH { $demolished++ }
package main;
-{ Foo::Sub->new }
-is($destroyed, 1, "non-Moose destructor called");
-is($demolished, 1, "Moose destructor called");
-Foo::Sub->meta->make_immutable;
-($destroyed, $demolished) = (0, 0);
-{ Foo::Sub->new }
-is($destroyed, 1, "non-Moose destructor called (immutable)");
-is($demolished, 1, "Moose destructor called (immutable)");
+
+with_immutable {
+ ($destroyed, $demolished) = (0, 0);
+ { Foo::Sub->new }
+ is($destroyed, 1, "non-Moose destructor called");
+ is($demolished, 1, "Moose destructor called");
+} 'Foo::Sub';