2 # This is automatically generated by author/import-moose-test.pl.
3 # DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
4 use t::lib::MooseCompat;
8 $TODO = q{Mouse is not yet completed};
18 my $object = MyClass->new;
20 # Removing the metaclass simulates the case where the metaclass object
21 # goes out of scope _before_ the object itself, which under normal
22 # circumstances only happens during global destruction.
23 Mouse::Util::remove_metaclass_by_name('MyClass');
25 # The bug happened when DEMOLISHALL called
26 # Mouse::Util::class_of($object) and did not get a metaclass object
28 lives_ok { $object->DESTROY }
29 'can call DESTROY on an object without a metaclass object in the CMOP cache';
32 MyClass->meta->make_immutable;
33 Mouse::Util::remove_metaclass_by_name('MyClass');
35 # The bug didn't manifest for immutable objects, but this test should
36 # help us prevent it happening in the future.
37 lives_ok { $object->DESTROY }
38 'can call DESTROY on an object without a metaclass object in the CMOP cache (immutable version)';