Test that extending oneself actually throws an error
Shawn M Moore [Mon, 29 Sep 2008 02:32:35 +0000 (02:32 +0000)]
t/303_RT_39001_fix.t [new file with mode: 0644]

diff --git a/t/303_RT_39001_fix.t b/t/303_RT_39001_fix.t
new file mode 100644 (file)
index 0000000..a185ef2
--- /dev/null
@@ -0,0 +1,39 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use Test::More tests => 4;
+use Test::Exception;
+
+BEGIN {
+    use_ok('Class::MOP');
+}
+
+=pod
+
+This tests a bug sent via RT #39001
+
+=cut
+
+{
+    package Foo;
+    use metaclass;
+}
+
+throws_ok {
+    Foo->meta->superclasses('Foo');
+} qr/^Recursive inheritance detected/, "error occurs when extending oneself";
+
+{
+    package Bar;
+    use metaclass;
+}
+
+lives_ok {
+    Foo->meta->superclasses('Bar');
+} "regular subclass";
+
+throws_ok {
+    Bar->meta->superclasses('Foo');
+} qr/^Recursive inheritance detected/, "error occurs when Bar extends Foo, when Foo is a Bar";
+