Skip to content

Commit 3417c13

Browse files
committed
Make xt/space-after-commma.t report line numbers for failures
1 parent 449c88d commit 3417c13

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

xt/space-after-commma.t

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ if @*ARGS {
2323
plan +@files;
2424

2525
for @files -> $file {
26-
my $ok = True;
27-
2826
my $out;
2927
if $file ~~ / '.pod6' $/ {
3028
my $pod2text = run($*EXECUTABLE-NAME, '--doc', $file, :out);
@@ -33,7 +31,8 @@ for @files -> $file {
3331
$out = $file.IO;
3432
}
3533

36-
for $out.lines -> $line is copy {
34+
my @failures;
35+
for $out.lines.kv -> $i, $line is copy {
3736
next if $line ~~ / ^ ' '/;
3837

3938
# ignore these cases already in docs/ that don't strictly follow rule
@@ -52,11 +51,11 @@ for @files -> $file {
5251
$line ~~ s:g/ '(3,)' //;
5352

5453
if $line ~~ / ',' [ <!before ' '> & <!before $> ] / {
55-
$ok = False;
54+
@failures.push: $i+1 # line number
5655
}
5756
}
58-
my $error = $file;
59-
ok $ok, "$error: Must have space after comma.";
57+
ok @failures == 0, "$file: Must have space after comma. "
58+
~ "(failures on lines: @failures.join(', '))";
6059
}
6160

6261
# vim: expandtab shiftwidth=4 ft=perl6

0 commit comments

Comments
 (0)