Commit | Line | Data |
30229767 |
1 | use strict; |
2 | use warnings; |
3 | |
4 | use Test::More tests => 4; |
5 | use Test::Exception; |
6 | |
7 | use Carp; |
8 | |
9 | $SIG{__WARN__} = \&croak; |
10 | |
11 | { |
12 | package Foo; |
13 | use Test::More; |
14 | use Test::Exception; |
15 | |
16 | throws_ok { |
17 | Class::MOP::in_global_destruction(); |
18 | } qr/\b deprecated \b/xmsi, 'complained'; |
19 | } |
20 | |
21 | { |
22 | package Bar; |
23 | use Test::More; |
24 | use Test::Exception; |
25 | |
26 | use Class::MOP::Deprecated -compatible => 0.93; |
27 | |
28 | throws_ok { |
29 | Class::MOP::in_global_destruction(); |
30 | } qr/\b deprecated \b/xmsi, 'complained'; |
31 | } |
32 | |
33 | { |
34 | package Baz; |
35 | use Test::More; |
36 | use Test::Exception; |
37 | |
38 | use Class::MOP::Deprecated -compatible => 0.92; |
39 | |
40 | lives_ok { |
41 | Class::MOP::in_global_destruction(); |
42 | } 'safe'; |
43 | } |
44 | |
45 | |
46 | { |
47 | package Baz::Inner; |
48 | use Test::More; |
49 | use Test::Exception; |
50 | |
51 | lives_ok { |
52 | Class::MOP::in_global_destruction(); |
53 | } 'safe in an inner class'; |
54 | } |
55 | |