Commit | Line | Data |
---|---|---|
7ae55cf7 | 1 | use strict; |
2 | use warnings; | |
86a4d873 | 3 | use Test::More; |
8371f3de | 4 | use Test::Exception; |
7ae55cf7 | 5 | |
efd3d14c | 6 | use Class::MOP; |
7ae55cf7 | 7 | |
8 | =pod | |
9 | ||
10 | This tests a bug sent via RT #39001 | |
11 | ||
12 | =cut | |
13 | ||
14 | { | |
15 | package Foo; | |
16 | use metaclass; | |
17 | } | |
18 | ||
8371f3de | 19 | throws_ok { |
7ae55cf7 | 20 | Foo->meta->superclasses('Foo'); |
8371f3de | 21 | } qr/^Recursive inheritance detected/, "error occurs when extending oneself"; |
7ae55cf7 | 22 | |
23 | { | |
24 | package Bar; | |
25 | use metaclass; | |
26 | } | |
27 | ||
28a82dda | 28 | # reset @ISA, so that calling methods like ->isa won't die (->meta does this |
29 | # if DEBUG_NO_META is set) | |
30 | @Foo::ISA = (); | |
31 | ||
8371f3de | 32 | lives_ok { |
7ae55cf7 | 33 | Foo->meta->superclasses('Bar'); |
8371f3de | 34 | } "regular subclass"; |
7ae55cf7 | 35 | |
8371f3de | 36 | throws_ok { |
7ae55cf7 | 37 | Bar->meta->superclasses('Foo'); |
8371f3de | 38 | } qr/^Recursive inheritance detected/, "error occurs when Bar extends Foo, when Foo is a Bar"; |
7ae55cf7 | 39 | |
86a4d873 | 40 | done_testing; |