Added failing test for long package name. ref. RT#83248
tokuhirom [Mon, 18 Feb 2013 02:09:54 +0000 (11:09 +0900)]
t/role-long-package-name.t [new file with mode: 0644]

diff --git a/t/role-long-package-name.t b/t/role-long-package-name.t
new file mode 100644 (file)
index 0000000..a103498
--- /dev/null
@@ -0,0 +1,42 @@
+use strict;
+use warnings;
+use Test::More;
+
+# using Role::Tiny->apply_roles_to_object with too many roles,
+# It makes 'Identifier too long' error in string 'eval'.
+# And, Moo uses string eval.
+{
+    package R::AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA;
+    use Role::Tiny;
+    package R::BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB;
+    use Role::Tiny;
+    package R::CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC;
+    use Role::Tiny;
+    package R::DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD;
+    use Role::Tiny;
+    package R::EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE;
+    use Role::Tiny;
+}
+
+{
+    package Foo;
+    sub new { bless {}, shift }
+}
+
+my $foo = Foo->new();
+for (qw(
+    R::AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+    R::BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
+    R::CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
+    R::DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
+    R::EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
+)) {
+    Role::Tiny->apply_roles_to_object($foo, $_);
+}
+
+my $pkg = ref $foo;
+note $pkg;
+eval "package $pkg;";
+ok(!$@) or diag $@;
+
+done_testing;