- Notifications
You must be signed in to change notification settings - Fork 135
/
Copy pathwacky.t
140 lines (98 loc) · 2.78 KB
/
wacky.t
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
useTest;
plan29;
# a bunch of weird behaviors I've thought of while reading and implementing S26.
# some of these may belong in other tests, but here's a nice dumping ground for
# them for now.
#| hello
is sub {
}.WHY, 'hello', 'leading document within an anoymous sub';
is sub {
#= hello
}.WHY, 'hello', 'trailing document within an anoymous sub';
#| hi
subfoo {} ; subbar {}
#= there
todo'needs RakuAST', 2;
is&foo.WHY, "hi", 'leading attaches to first';
is&bar.WHY, "there", 'trailing attaches to last';
subone { #= first
#= second
}
is&one.WHY, 'first second', 'trailing same line + inner line';
subtwo() {}
#= attached
is&two.WHY, 'attached', 'complete sub attaches ok on next line';
subthree {
#= yet another comment
}
is&three.WHY, 'yet another comment', "declaration start on its own line";
subfour {}
#= after four
#| before five
subfive {}
is&four.WHY, 'after four', "comments shouldn't interfere with each other";
is&five.WHY, 'before five', "comments shouldn't interfere with each other";
classA {
has$.first; has$.second; #= comment
}
my$first= A.^attributes.first(*.nameeq'$!first');
my$second= A.^attributes.first(*.nameeq'$!second');
ok!$first.WHY.defined, 'two attrs on a line, first ignored';
is$second.WHY, 'comment', 'two attrs on a line, last binds';
classB {
has$.attribute#= first trailing
#= second trailing
=17;
}
$first= B.^attributes.first(*.nameeq'$!attribute');
todo'needs RakuAST', 1;
is$first.WHY, 'first trailing second trailing', 'interleaved trailing';
subsix(Str$param1, Str$param2) {
#= trailing comment for param2
}
my ( $param1, $param2 ) =&six.signature.params;
todo'needs RakuAST', 1;
ok!&six.WHY.defined, "does not bind to sub";;
ok!$param1.WHY.defined, "does not bind to first parameter";
todo'needs RakuAST', 1;
is$param2.WHY, 'trailing comment for param2', "last on line binds";
subseven(
Str$param
)
#= trailing comment
{
}
($param1,) =&seven.signature.params;
ok!$param1.WHY.defined, 'does not bind to anything';
subeight( #| leading for param
Str$param
) {}
my ( $param ) =&eight.signature.params;
ok!&eight.WHY.defined;
is$param.WHY, 'leading for param';
subnine( #= sub comment
Str$param
) {}
( $param ) =&nine.signature.params;
is&nine.WHY, 'sub comment';
ok!$param.WHY.defined;
#| leading comment for eleven
subeleven {}
#= trailing comment for eleven
is&eleven.WHY, "leading comment for eleven\ntrailing comment for eleven",
"space separation ok for leading, not for trailing";
my@pod_headers= (
'pod',
'comment',
'table',
'code',
);
for@pod_headers->$chunk {
my$ok=1;
EVAL"=for $chunk\n\$ok = 0";
ok$ok, "=for $chunk";
$ok=1;
EVAL"=$chunk\n\$ok = 0";
ok$ok, "=$chunk";
}
# vim: expandtab shiftwidth=4