From: tokuhirom Date: Mon, 18 Feb 2013 02:09:54 +0000 (+0900) Subject: Added failing test for long package name. ref. RT#83248 X-Git-Tag: v1.003002~8 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1c3676152ad41bc2b04a0818c879b40ef755f67e;p=gitmo%2FRole-Tiny.git Added failing test for long package name. ref. RT#83248 --- diff --git a/t/role-long-package-name.t b/t/role-long-package-name.t new file mode 100644 index 0000000..a103498 --- /dev/null +++ b/t/role-long-package-name.t @@ -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;