Import Moose/t/010_basics/*.t
[gitmo/Mouse.git] / t / 010_basics / failing / 020-global-destruction.t
diff --git a/t/010_basics/failing/020-global-destruction.t b/t/010_basics/failing/020-global-destruction.t
new file mode 100755 (executable)
index 0000000..484a722
--- /dev/null
@@ -0,0 +1,50 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 4;
+
+{
+    package Foo;
+    use Mouse;
+
+    sub DEMOLISH {
+        my $self = shift;
+        my ($igd) = @_;
+        ::ok(
+            !$igd,
+            'in_global_destruction state is passed to DEMOLISH properly (false)'
+        );
+    }
+}
+
+{
+    my $foo = Foo->new;
+}
+
+{
+    package Bar;
+    use Mouse;
+
+    sub DEMOLISH {
+        my $self = shift;
+        my ($igd) = @_;
+        ::ok(
+            !$igd,
+            'in_global_destruction state is passed to DEMOLISH properly (false)'
+        );
+    }
+
+    __PACKAGE__->meta->make_immutable;
+}
+
+{
+    my $bar = Bar->new;
+}
+
+ok(
+    $_,
+    'in_global_destruction state is passed to DEMOLISH properly (true)'
+) for split //, `$^X t/010_basics/020-global-destruction-helper.pl`;
+