Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Test for return type in signatures
  • Loading branch information
Altai-man committed Dec 6, 2016
1 parent f8448f2 commit 88c2f5f
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions t/return-type.t
Expand Up @@ -10,18 +10,13 @@ my @files;
plan +@files;

for @files -> $file {
# If it is the any Signature-related exception
# or Signature.pod, then presence of '-->' is valid.
{ pass "$file return types are valid" ; next } if $file ~~ /Signature/;
my @lines;
my Int $line-no = 1;
for $file.IO.lines -> $line {
if so $line ~~ /(method|sub) .+? '-->'/
&& $line !~~ /'--> True'/
&& $line !~~ /'--> False'/ {
@lines.push($line-no);
}
$line-no++;
if so $line ~~ /(multi|method|sub) .+? ')' ' '+? 'returns' ' '+? (<alnum>|':')+? $/ {
@lines.push($line-no);
}
$line-no++;
}
if @lines {
flunk "$file has bad return type: {@lines}";
Expand Down

0 comments on commit 88c2f5f

Please sign in to comment.