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