Skip to content

Commit 20bfc3d

Browse files
committed
Rework tests to skip files after the files are selected
not only if we're picking the default files; allows us to not care if we pass in a bunch of inappropriate files for a test with TEST_FILES
1 parent 32002de commit 20bfc3d

File tree

9 files changed

+35
-46
lines changed

9 files changed

+35
-46
lines changed

t/pod-valid.t

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,10 @@ if @*ARGS {
1717
if %*ENV<TEST_FILES> {
1818
@files = %*ENV<TEST_FILES>.split(',');
1919
} else {
20-
for qx<git ls-files>.lines -> $file {
21-
next unless $file ~~ / '.pod6' $/;
22-
push @files, $file;
23-
}
20+
@files = qx<git ls-files>.lines;
2421
}
2522
}
23+
@files = @files.grep(/'.pod6'$/);
2624

2725
plan +@files;
2826

t/tabs.t

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,14 @@ if @*ARGS {
1010
if %*ENV<TEST_FILES> {
1111
@files = %*ENV<TEST_FILES>.split(',');
1212
} else {
13-
for qx<git ls-files>.lines -> $file {
14-
next if $file eq "LICENSE"|"Makefile";
15-
next if $file ~~ / 'custom-theme'/;
16-
next if $file ~~ / 'jquery'/;
17-
next if $file ~~ / '.png' $/;
18-
next if $file ~~ / '.ico' $/;
19-
20-
push @files, $file;
21-
}
13+
@files = qx<git ls-files>.lines;
2214
}
2315
}
16+
@files = @files.grep({$_ ne 'LICENSE'|'Makefile'})\
17+
.grep({! $_.contains('custom-theme')})\
18+
.grep({! $_.contains('jquery')})\
19+
.grep({! $_.ends-with('.png')})\
20+
.grep({! $_.ends-with('.ico')});
2421

2522
plan +@files;
2623

xt/aspell.t

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,13 @@ if @*ARGS {
2525
if %*ENV<TEST_FILES> {
2626
@files = %*ENV<TEST_FILES>.split(',');
2727
} else {
28-
for qx<git ls-files>.lines -> $file {
29-
next unless $file ~~ / '.' ('pod6'|'md') $/;
30-
next if $file ~~ / 'contributors.pod6' $/; # names are hard.
31-
push @files, $file;
32-
}
28+
@files = qx<git ls-files>.lines;
3329
}
3430
}
3531

32+
@files = @files.grep({$_.ends-with('.pod6') or $_.ends-with('.md')})\
33+
.grep({! $_.ends-with('contributors.pod6')});
34+
3635
plan +@files;
3736
my $max-jobs = %*ENV<TEST_THREADS> // 2;
3837

xt/duplicates.t

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,10 @@ if @*ARGS {
2424
if %*ENV<TEST_FILES> {
2525
@files = %*ENV<TEST_FILES>.split(',');
2626
} else {
27-
for qx<git ls-files>.lines -> $file {
28-
next unless $file ~~ / '.' ('pod6'|'md') $/;
29-
push @files, $file;
30-
}
27+
@files = qx<git ls-files>.lines;
3128
}
3229
}
30+
@files = @files.grep({$_.ends-with('.pod6') or $_.ends-with('.md')});
3331

3432
plan +@files;
3533

xt/examples-compilation.t

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,12 @@ if @*ARGS {
2525
if %*ENV<TEST_FILES> {
2626
@files = %*ENV<TEST_FILES>.split(',');
2727
} else {
28-
for qx<git ls-files doc>.lines -> $file {
29-
next unless $file ~~ / '.pod6' $/;
30-
push @files, $file;
31-
}
28+
@files = qx<git ls-files doc>.lines;
3229
}
3330
}
3431

32+
@files = @files.grep({$_.ends-with('.pod6')});
33+
3534
sub walk($arg) {
3635
given $arg {
3736
when Pod::FormattingCode { walk $arg.contents }

xt/perl-nbsp.t

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,12 @@ if @*ARGS {
99
if %*ENV<TEST_FILES> {
1010
@files = %*ENV<TEST_FILES>.split(',');
1111
} else {
12-
for qx<git ls-files>.lines -> $file {
13-
next unless $file ~~ / '.pod6' $/;
14-
push @files, $file;
15-
}
12+
@files = qx<git ls-files doc>.lines;
1613
}
1714
}
1815

16+
@files = @files.grep({$_.ends-with('.pod6')});
17+
1918
plan +@files;
2019

2120
for @files.sort -> $file {

xt/return-type.t

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ if @*ARGS {
1212
if %*ENV<TEST_FILES> {
1313
@files = %*ENV<TEST_FILES>.split(',');
1414
} else {
15-
@files = qx<git ls-files>.lines.grep(* ~~ /'.pod6'/).grep(* ~~ /Type | Language/);
15+
@files = qx<git ls-files>.lines;
1616
}
1717
}
1818

19+
@files = @files.grep(* ~~ /'.pod6'/).grep(* ~~ /Type | Language/);
20+
1921
plan +@files;
2022

2123
for @files -> $file {

xt/space-after-comma.t

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,13 @@ if @*ARGS {
1616
if %*ENV<TEST_FILES> {
1717
@files = %*ENV<TEST_FILES>.split(',');
1818
} else {
19-
for qx<git ls-files>.lines -> $file {
20-
next unless $file ~~ / '.' ('pod6'|'md') $/;
21-
next if $file ~~ / 'contributors.pod6' $/; # names are hard.
22-
push @files, $file;
23-
}
19+
@files = qx<git ls-files>.lines;
2420
}
2521
}
2622

23+
@files = @files.grep({$_.ends-with('.pod6') or $_.ends-with('.md')})\
24+
.grep({! $_.ends-with('contributors.pod6')});
25+
2726
plan +@files;
2827
my $max-jobs = %*ENV<TEST_THREADS> // 2;
2928
my %output;

xt/trailing-whitespace.t

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,17 @@ if @*ARGS {
1010
if %*ENV<TEST_FILES> {
1111
@files = %*ENV<TEST_FILES>.split(',');
1212
} else {
13-
for qx<git ls-files>.lines -> $file {
14-
next if $file eq "LICENSE"|"Makefile";
15-
next if $file ~~ / 'custom-theme'/;
16-
next if $file ~~ / 'jquery'/;
17-
next if $file ~~ / '.png' $/;
18-
next if $file ~~ / '.ico' $/;
19-
next if $file ~~ / 'util/trigger-rebuild.txt' /;
20-
21-
push @files, $file;
22-
}
13+
@files = qx<git ls-files>.lines;
2314
}
2415
}
2516

17+
@files = @files.grep({$_ ne 'LICENSE'|'Makefile'})\
18+
.grep({! $_.contains('custom-theme')})\
19+
.grep({! $_.contains('util/trigger-rebuild.txt')})\
20+
.grep({! $_.contains('jquery')})\
21+
.grep({! $_.ends-with('.png')})\
22+
.grep({! $_.ends-with('.ico')});
23+
2624
plan +@files;
2725

2826
for @files -> $file {

0 commit comments

Comments
 (0)