summaryrefslogtreecommitdiffstats
path: root/t/40-destructor.t
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2010-06-15 01:36:37 -0500
committerJesse Luehrs <doy@tozt.net>2010-06-15 01:36:37 -0500
commit60c5f48aff6a579ce22bd4b4245f7be346609901 (patch)
tree7025b94a0470cef60d9c3694d0dbf247f5b30aaa /t/40-destructor.t
parent571bfa3b91ff5567338948776b6fce84d3ede09e (diff)
downloadmoosex-nonmoose-60c5f48aff6a579ce22bd4b4245f7be346609901.tar.gz
moosex-nonmoose-60c5f48aff6a579ce22bd4b4245f7be346609901.zip
convert to new dzil stuff
Diffstat (limited to 't/40-destructor.t')
-rw-r--r--t/40-destructor.t29
1 files changed, 29 insertions, 0 deletions
diff --git a/t/40-destructor.t b/t/40-destructor.t
new file mode 100644
index 0000000..f2c88be
--- /dev/null
+++ b/t/40-destructor.t
@@ -0,0 +1,29 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More tests => 4;
+
+my $destroyed = 0;
+my $demolished = 0;
+package Foo;
+
+sub new { bless {}, shift }
+
+sub DESTROY { $destroyed++ }
+
+package Foo::Sub;
+use Moose;
+use MooseX::NonMoose;
+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)");