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