remove redundant '; 1' after require
[p5sagit/Function-Parameters.git] / t / foreign / Method-Signatures / comments.t
CommitLineData
700071de 1#!perl
2use strict;
3use warnings FATAL => 'all';
4
5use Test::More
8d34f4d9 6 eval { require Moose }
1a52f2db 7 ? (tests => 5)
8 : (skip_all => "Moose required for testing types")
700071de 9;
10use Test::Fatal;
11
12use Function::Parameters qw(:strict);
13
14
15is 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
30is 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#
1a52f2db 46 is exception
47 {
48 eval q{
700071de 49# use MooseX::Declare;
50# use Method::Signatures::Modifiers;
1a52f2db 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';
700071de 63#}
1a52f2db 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
700071de 87#done_testing();