From dfc2ff5f2709f198d9fdb21d84a2534acc9f3670 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Tue, 15 Jun 2010 03:39:08 -0500 Subject: make more tests use with_immutable --- t/40-destructor.t | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 't/40-destructor.t') 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'; -- cgit v1.2.3-54-g00ecf