Skip to content

Instantly share code, notes, and snippets.

@coke
Last active Feb 1, 2021
Embed
What would you like to do?
$ xt/final-newline.t LICENSE
18.1982403
1..0 # Skipped: No relevant files specified
$ raku -version
Welcome to Rakudo(tm) v2020.12-51-g12b49b834.
Implementing the Raku(tm) programming language v6.d.
Built on MoarVM version 2020.12-83-ga5b8a815f.
#!/usr/bin/env raku
use Test;
use lib $*PROGRAM.parent(2).child('lib');
BEGIN my $a = now;
use Test-Files;
BEGIN my $b = now;
BEGIN say $b-$a;
=begin overview
Make sure that text files end in a newline
=end overview
my @files = Test-Files.files\
.grep({$_ ne 'LICENSE'})\
.grep({! $_.contains: 'custom-theme'})\
.grep({! $_.contains: 'util/trigger-rebuild.txt'})\
.grep({! $_.contains: 'jquery'})\
.grep({! $_.ends-with: '.png'})\
.grep({! $_.ends-with: '.svg'})\
.grep({! $_.ends-with: '.ico'});
Test-Files.plan(+@files);
for @files -> $file {
ok $file.IO.slurp.substr(*-1) eq "\n", "$file must end in a newline";
}
# vim: expandtab shiftwidth=4 ft=perl6
$ RAKUDO_MODULE_DEBUG=1 xt/final-newline.t LICENSE | pbcopy
1 RMD: Requested for settings CORE.d
1 RMD: Loading settings CORE.d
1 RMD: Loading bytecode from CORE.d.setting.moarvm
1 RMD: going to load Perl6::BOOTSTRAP::v6d
1 RMD: Requested for settings CORE.c
1 RMD: Loading settings CORE.c
1 RMD: Loading bytecode from CORE.c.setting.moarvm
1 RMD: going to load Perl6::BOOTSTRAP::v6c
1 RMD: Settings CORE.c loaded
1 RMD: Settings CORE.d loaded
1 RMD: Attempting 'Test' as a pragma
1 RMD: 'Test' is not a valid pragma
1 RMD: Attempting to load 'Test'
1 RMD: Late loading 'Test'
1 RMD: try-load 2D4A7CA10695CD2B374573413D261A660E282E2A: /Volumes/BUKKIT/Users/coke/p6/share/perl6/core/sources/2D4A7CA10695CD2B374573413D261A660E282E2A
1 RMD: Trying to load 2D4A7CA10695CD2B374573413D261A660E282E2A from /Volumes/BUKKIT/Users/coke/.raku/precomp
1 RMD: Trying to load 2D4A7CA10695CD2B374573413D261A660E282E2A from /Volumes/BUKKIT/Users/coke/p6/share/perl6/site/precomp
1 RMD: Trying to load 2D4A7CA10695CD2B374573413D261A660E282E2A from /Volumes/BUKKIT/Users/coke/p6/share/perl6/vendor/precomp
1 RMD: Trying to load 2D4A7CA10695CD2B374573413D261A660E282E2A from /Volumes/BUKKIT/Users/coke/p6/share/perl6/core/precomp
1 RMD: Trying to load 2D4A7CA10695CD2B374573413D261A660E282E2A.repo-id from /Volumes/BUKKIT/Users/coke/.raku/precomp
1 RMD: Repo changed:
6041F2786684FF56922961AFB40A5F8A581C2315
E20ACDE2F5BF8B3197BAA05DE375DFD178730D10
Need to re-check dependencies.
1 RMD: Repo chain changed:
6041F2786684FF56922961AFB40A5F8A581C2315
E20ACDE2F5BF8B3197BAA05DE375DFD178730D10
Need to re-check dependencies.
1 RMD: Loading precompiled
/Volumes/BUKKIT/Users/coke/p6/share/perl6/core/precomp/17BD660697AD6A1106FB97A0AD4AC69B4EE7BAC8/2D/2D4A7CA10695CD2B374573413D261A660E282E2A
1 RMD: Requested for settings CORE.d
1 RMD: Performing imports for 'Test'
1 RMD: Imports for 'Test' done
1 RMD: Attempting 'lib' as a pragma
1 RMD: Successfully handled 'lib' as a pragma
1 RMD: Attempting 'Test-Files' as a pragma
1 RMD: 'Test-Files' is not a valid pragma
1 RMD: Attempting to load 'Test-Files'
1 RMD: Late loading 'Test-Files'
<Longest pause is here>
1 RMD: try-load 6F46A404980B5BDAEDD015CAF25F8043364DBF53: /Volumes/BUKKIT/Users/coke/sandbox/raku-doc/lib/Test-Files.pm6
1 RMD: Trying to load 6F46A404980B5BDAEDD015CAF25F8043364DBF53 from /Volumes/BUKKIT/Users/coke/sandbox/raku-doc/lib/.precomp
1 RMD: Trying to load 6F46A404980B5BDAEDD015CAF25F8043364DBF53.repo-id from /Volumes/BUKKIT/Users/coke/sandbox/raku-doc/lib/.precomp
1 RMD: Repo chain changed:
A353198F4A21876CA04D8A1BD956372A42DEF85F
E20ACDE2F5BF8B3197BAA05DE375DFD178730D10
Need to re-check dependencies.
1 RMD: Loading precompiled
/Volumes/BUKKIT/Users/coke/sandbox/raku-doc/lib/.precomp/17BD660697AD6A1106FB97A0AD4AC69B4EE7BAC8/6F/6F46A404980B5BDAEDD015CAF25F8043364DBF53
1 RMD: Requested for settings CORE.d
1 RMD: Performing imports for 'Test-Files'
1 RMD: Imports for 'Test-Files' done
1 RMD: Requested for settings CORE.d
unit class Test-Files;
method plan(Int(Cool) $count, :$skip-msg="No relevant files specified") {
#use Test;
#if $count {
# plan $count;
#} else {
# plan :skip-all($skip-msg);
#}
}
method files() {
my @files;
if @*ARGS {
@files = @*ARGS;
} else {
if %*ENV<TEST_FILES> {
@files = %*ENV<TEST_FILES>.trim.split(/ \s /).grep(*.IO.e);
} else {
@files = qx<git ls-files>.lines;
}
}
return @files.sort;
}
method pods() {
return $.files.grep({$_.ends-with: '.pod6'})
}
method documents() {
return $.files.grep({$_.ends-with: '.pod6' or $_.ends-with: '.md'})
}
method tests() {
return $.files.grep({$_.ends-with: '.t'})
}
# vim: expandtab shiftwidth=4 ft=perl6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment