1 2use strict; 3use warnings; 4 5use Test::More; 6use Test::Exception; 7 8use Method::Signatures; 9 10 11lives_ok 12{ 13 eval q{ 14 func foo ( 15 Int :$foo, # this is foo 16 Int :$bar # this is bar 17 ) 18 { 19 } 20 21 1; 22 } or die; 23} 24'survives comments within the signature itself'; 25 26lives_ok 27{ 28 eval q{ 29 func bar ( Int :$foo, Int :$bar ) # this is a signature 30 { 31 } 32 33 1; 34 } or die; 35} 36'survives comments between signature and open brace'; 37 38SKIP: 39{ 40 eval { require MooseX::Declare } or skip "MooseX::Declare required for this test", 1; 41 42 lives_ok 43 { 44 eval q{ 45 use MooseX::Declare; 46 use Method::Signatures::Modifiers; 47 48 class Foo 49 { 50 method bar ( Int :$foo, Int :$bar ) # this is a signature 51 { 52 } 53 } 54 55 1; 56 } or die; 57 } 58 'survives comments between signature and open brace'; 59} 60 61 62TODO: { 63 local $TODO = "closing paren in comment: rt.cpan.org 81364"; 64 65 lives_ok 66 { 67 # When this fails, it produces 'Variable "$bar" is not imported' 68 # This is expected to fail, don't bother the user. 69 no warnings; 70 eval q{ 71 func special_comment ( 72 $foo, # ) 73 $bar 74 ) 75 { 42 } 76 1; 77 } or die; 78 } 79 'closing paren in comment'; 80 is eval q[special_comment("this", "that")], 42; 81} 82 83done_testing(); 84