Skip to content

Commit c0cf73b

Browse files
committed
Add a test to avoid using ".." after a word
(typically you mean either . or ...) Closes #1632
1 parent 235259e commit c0cf73b

File tree

5 files changed

+73
-4
lines changed

5 files changed

+73
-4
lines changed

doc/Language/5to6-perlop.pod6

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ use C<@ones = 1 xx 80;>.
9494
=head2 Additive Operators
9595
9696
Binary C<+> and C<-> do addition and subtraction, respectively, as you would
97-
expect..
97+
expect.
9898
9999
As C<.> is the method call operator, so binary C<~> acts as the
100100
concatenation operator in Perl 6.

doc/Type/Cool.pod6

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,7 @@ Defined as:
817817
818818
Coerces the invocant (or in sub form, its argument) to L<Str|/type/Str>, and returns it with the first letter
819819
case-folded to title case (or where not available, upper case), and the rest
820-
of the string case-folded to lower case..
820+
of the string case-folded to lower case.
821821
822822
say 'abC'.tclc; # OUTPUT: «Abc␤»
823823

doc/Type/IO/Spec/Win32.pod6

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ an object of the appropriate type
1212
1313
B<NOTE:> the C<IO::Spec::*> classes provide low-level path operations. Unless
1414
you're creating your own high-level path manipulation routines, you don't
15-
need to use C<IO::Spec::*>. Use L«C<IO::Path>|/type/IO::Path» instead..
15+
need to use C<IO::Spec::*>. Use L«C<IO::Path>|/type/IO::Path» instead.
1616
1717
B<NOTE2:> no special validation is done by these classes (e.g. check whether
1818
path contains a null character). It is the job of higher-level classes, like

doc/Type/Metamodel/ClassHOW.pod6

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ the method cache.
4949
5050
If C<$condition> returns a true value,
5151
C<$calculator> is called with the same arguments, and must return the code
52-
object to be invoked as the method, and is added to the method cache..
52+
object to be invoked as the method, and is added to the method cache.
5353
5454
If C<$condition> returns a false value, the
5555
next fallback (if any) is tried, and if none matches, an exception

xt/double-dots.t

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/usr/bin/env perl6
2+
3+
use v6;
4+
use Test;
5+
use lib 'lib';
6+
7+
=begin overview
8+
9+
Avoid using C<..> - usually a typo for C<.> or C<...>
10+
11+
=end overview
12+
13+
my @files;
14+
15+
if @*ARGS {
16+
@files = @*ARGS;
17+
} else {
18+
if %*ENV<TEST_FILES> {
19+
@files = %*ENV<TEST_FILES>.split(' ').grep(*.IO.e);
20+
} else {
21+
@files = qx<git ls-files>.lines;
22+
}
23+
}
24+
25+
@files = @files.grep({$_.ends-with('.pod6') or $_.ends-with('.md')});
26+
27+
plan +@files;
28+
my $max-jobs = %*ENV<TEST_THREADS> // 2;
29+
my %output;
30+
31+
sub test-promise($promise) {
32+
my $file = $promise.command[*-1];
33+
test-it(%output{$file}, $file);
34+
}
35+
36+
sub test-it(Str $output, Str $file) {
37+
my $ok = True;
38+
39+
for $output.lines -> $line {
40+
if $line ~~ / <alpha> '..' (<space> | $) / {
41+
diag "Failure on line `$line`";
42+
$ok = False;
43+
}
44+
}
45+
my $error = $file;
46+
ok $ok, "$error: file contains ..";
47+
}
48+
49+
my @jobs;
50+
for @files -> $file {
51+
52+
my $output = "";
53+
54+
if $file ~~ / '.pod6' $/ {
55+
my $a = Proc::Async.new($*EXECUTABLE-NAME, '--doc', $file);
56+
%output{$file} = "";
57+
$a.stdout.tap(-> $buf { %output{$file} = %output{$file} ~ $buf });
58+
push @jobs: $a.start;
59+
if +@jobs > $max-jobs {
60+
test-promise(await @jobs.shift)
61+
}
62+
} else {
63+
test-it($file.IO.slurp, $file);
64+
}
65+
}
66+
67+
for @jobs.map: {await $_} -> $r { test-promise($r) }
68+
69+
# vim: expandtab shiftwidth=4 ft=perl6

0 commit comments

Comments
 (0)