summaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2009-09-12 14:29:18 -0500
committerJesse Luehrs <doy@tozt.net>2009-09-27 16:12:25 -0500
commit372ed0ebfabcd81529da7d1f41bb483b6a998fa2 (patch)
tree262b6064eb47827ad3760132f0dbfb48c7ff56a0 /t
parent9318538eea1b3d6352d28c9db57037bb7710ac3e (diff)
downloadmoosex-nonmoose-372ed0ebfabcd81529da7d1f41bb483b6a998fa2.tar.gz
moosex-nonmoose-372ed0ebfabcd81529da7d1f41bb483b6a998fa2.zip
TODO test for DESTROY/DEMOLISH support
Diffstat (limited to 't')
-rw-r--r--t/040-destructor.t33
1 files changed, 33 insertions, 0 deletions
diff --git a/t/040-destructor.t b/t/040-destructor.t
new file mode 100644
index 0000000..2900a15
--- /dev/null
+++ b/t/040-destructor.t
@@ -0,0 +1,33 @@
+#!/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");
+{ local $TODO = "don't support destructors properly yet";
+is($demolished, 1, "Moose destructor called");
+}
+Foo::Sub->meta->make_immutable;
+($destroyed, $demolished) = (0, 0);
+{ Foo::Sub->new }
+{ local $TODO = "don't support destructors properly yet";
+is($destroyed, 1, "non-Moose destructor called (immutable)");
+}
+is($demolished, 1, "Moose destructor called (immutable)");