From: Florian Ragwitz Date: Tue, 10 Mar 2009 00:11:13 +0000 (+0100) Subject: Testcase for get_code_info on a sub that's still being compiled X-Git-Tag: 0.78_01~78 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1b7e9baeb37e159ef1f8fda3118e681bf32425d4;p=gitmo%2FClass-MOP.git Testcase for get_code_info on a sub that's still being compiled --- diff --git a/t/082_get_code_info.t b/t/082_get_code_info.t index 47dfa9e..7e1e6d8 100644 --- a/t/082_get_code_info.t +++ b/t/082_get_code_info.t @@ -6,7 +6,7 @@ use Test::More; BEGIN { $^P &= ~0x200; # Don't munger anonymous sub names if ( eval 'use Sub::Name qw(subname); 1;' ) { - plan tests => 5; + plan tests => 6; } else { plan skip_all => 'These tests require Sub::Name'; @@ -36,3 +36,14 @@ code_name_is( subname("", sub {}), "main" => "" ); require Class::MOP::Method; code_name_is( \&Class::MOP::Method::name, "Class::MOP::Method", "name" ); +{ + package Foo; + + sub MODIFY_CODE_ATTRIBUTES { + my ($class, $code) = @_; + ::ok(!Class::MOP::get_code_info($code), "no name for a coderef that's still compiling"); + return (); + } + + sub foo : Bar {} +}