Skip to content

Commit 014c7e6

Browse files
committed
Tests for tests spun off and included
Now it checks not only valid Pod6, but also valid syntax. This is actually a workaround for #1951. It was a Rakudo error having to do with the setting up of a compunit, which is created when the file is interpreted. It happened, when it did, by the end of the tests. It became less frequent when the tests were split in two batches, but it still happens from time to time. Spinning off these tests should solve it. Besides, testing test files for valid POD6 is not so critical, so it might be a good idea to move this new one to an author test. Anyway, closes #1951. If it keeps happening, we'll try to find another workaround.
1 parent 350386a commit 014c7e6

File tree

2 files changed

+56
-4
lines changed

2 files changed

+56
-4
lines changed

t/02-pod-valid.t

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,17 @@ use Test-Files;
99

1010
=begin overview
1111
12-
Ensure any text that isn't a code example is valid Pod 6.
12+
Ensure any text that isn't a code example is valid C<Pod 6>.
1313
1414
=end overview
1515

1616
my $max-jobs = %*ENV<TEST_THREADS> // 2;
1717

1818
my @files-pod = Test-Files.files.grep({$_.ends-with: '.pod6'});
19-
my @files-t = Test-Files.files.grep({$_.ends-with: '.t'});
20-
plan +@files-t + +@files-pod;
19+
plan +@files-pod;
2120

2221
my %data;
2322
test-files( @files-pod ); #Splits in two batches to avoid some errors.
24-
test-files( @files-t );
2523

2624
sub test-it($job) {
2725
my $file = $job.command[*-1];

t/02-tests-valid.t

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/usr/bin/env perl6
2+
3+
use v6;
4+
use lib 'lib';
5+
use Test;
6+
BEGIN plan :skip-all<Test applicable to git checkout only> unless '.git'.IO.e;
7+
8+
use Test-Files;
9+
10+
=begin overview
11+
12+
Ensure any test file, including author tests, have clean syntax and POD
13+
14+
=end overview
15+
16+
my $max-jobs = %*ENV<TEST_THREADS> // 2;
17+
18+
my @files-t = Test-Files.files.grep({$_.ends-with: '.t'});
19+
plan +@files-t;
20+
21+
my %data;
22+
test-files( @files-t );
23+
24+
sub test-it($job) {
25+
my $file = $job.command[*-1];
26+
ok !$job.exitcode && !%data{$file}, "$file POD6 and syntax check out"
27+
}
28+
29+
sub test-files( @files ) {
30+
my @jobs;
31+
%data{@files} = 0 xx @files;
32+
for @files -> $file {
33+
my $p = Proc::Async.new($*EXECUTABLE-NAME, '--c', $file);
34+
$p.stdout.tap: {;};
35+
$p.stderr.tap: {
36+
%*ENV<P6_DOC_TEST_VERBOSE>
37+
and diag qq:to/EOF/;
38+
There's been this error in file: $file
39+
$_
40+
EOF
41+
%data{$file} = 1;
42+
}
43+
push @jobs: $p.start;
44+
if +@jobs > $max-jobs {
45+
test-it(await @jobs.shift);
46+
}
47+
}
48+
49+
# In case there's something left to run.
50+
for @jobs.map: {await $_} -> $r { test-it($r) }
51+
}
52+
53+
54+
# vim: expandtab shiftwidth=4 ft=perl6

0 commit comments

Comments
 (0)