Bug 42886: Add xt test to prevent future omission of css files in Makefile
Note that t/Makefile.t and xt/check_makefile.t were doing the same test. Merging them. Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
fc66d4da43
commit
294970b5d6
55
t/Makefile.t
55
t/Makefile.t
|
|
@ -1,55 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
# This file is part of Koha.
|
||||
#
|
||||
# Koha is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Koha is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Koha; if not, see <https://www.gnu.org/licenses>.
|
||||
|
||||
use Modern::Perl;
|
||||
use Test::NoWarnings;
|
||||
use Test::More tests => 3;
|
||||
use File::Slurp;
|
||||
|
||||
my @files = `git ls-tree HEAD|tr -s '\t' ' '|cut -d' ' -f4`;
|
||||
ok( @files > 0, 'We should test something' );
|
||||
|
||||
my $MakeFile = read_file('Makefile.PL');
|
||||
my @MakeFile = split "\n", $MakeFile;
|
||||
|
||||
my @ignored = qw(
|
||||
.editorconfig
|
||||
.gitignore
|
||||
.mailmap
|
||||
.nvmrc
|
||||
.perlcriticrc
|
||||
.proverc
|
||||
.proverc.dist
|
||||
.stylelintrc.json
|
||||
LICENSE
|
||||
README.md
|
||||
SECURITY.md
|
||||
README.robots
|
||||
debian
|
||||
install-CPAN.pl
|
||||
koha_perl_deps.pl
|
||||
);
|
||||
|
||||
my @not_mapped;
|
||||
for my $file (@files) {
|
||||
chomp $file;
|
||||
unless ( grep { /$file/ } @MakeFile or grep { /$file/ } @ignored ) {
|
||||
push @not_mapped, $file;
|
||||
}
|
||||
}
|
||||
|
||||
is( @not_mapped, 0, 'All directories should be mapped' . ( @not_mapped ? ': ' . join ',', @not_mapped : '' ) );
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
# Copyright 2020 Koha Development Team
|
||||
# Copyright 2026 Koha Development Team
|
||||
#
|
||||
# This file is part of Koha.
|
||||
#
|
||||
|
|
@ -25,16 +25,59 @@ use File::Spec;
|
|||
use File::Slurp qw( read_file );
|
||||
use Data::Dumper;
|
||||
|
||||
my $curdir = File::Spec->curdir();
|
||||
my @dirs = `git ls-tree -d --name-only HEAD`;
|
||||
ok( @dirs > 0, 'We should test something' );
|
||||
my $makefile = read_file("$curdir/Makefile.PL");
|
||||
my @missing;
|
||||
for my $d ( sort @dirs ) {
|
||||
chomp $d;
|
||||
next if $d =~ /^debian$/;
|
||||
next if $makefile =~ m{'\./$d('|\/)}xms;
|
||||
push @missing, $d;
|
||||
}
|
||||
subtest 'All files should be mapped in Makefile.pl' => sub {
|
||||
plan tests => 2;
|
||||
my @files = `git ls-tree --name-only HEAD`;
|
||||
ok( @files > 0, 'We should test something' );
|
||||
my @MakeFile = read_file('Makefile.PL');
|
||||
my @ignored = qw(
|
||||
.editorconfig
|
||||
.gitignore
|
||||
.mailmap
|
||||
.nvmrc
|
||||
.perlcriticrc
|
||||
.proverc
|
||||
.proverc.dist
|
||||
.stylelintrc.json
|
||||
LICENSE
|
||||
README.md
|
||||
SECURITY.md
|
||||
README.robots
|
||||
debian
|
||||
install-CPAN.pl
|
||||
koha_perl_deps.pl
|
||||
);
|
||||
|
||||
is( scalar @missing, 0, 'All directories must be listed in Makefile.PL' ) or diag Dumper \@missing;
|
||||
my @not_mapped;
|
||||
for my $file (@files) {
|
||||
chomp $file;
|
||||
unless ( grep { /$file/ } @MakeFile or grep { $_ eq $file } @ignored ) {
|
||||
push @not_mapped, $file;
|
||||
}
|
||||
}
|
||||
|
||||
is( @not_mapped, 0, 'All directories should be mapped' . ( @not_mapped ? ': ' . join ',', @not_mapped : '' ) );
|
||||
|
||||
};
|
||||
|
||||
subtest 'All CSS files should be mapped' => sub {
|
||||
plan tests => 2;
|
||||
|
||||
my @css_files =
|
||||
`git ls-tree --name-only HEAD koha-tmpl/intranet-tmpl/prog/css/src/ koha-tmpl/opac-tmpl/bootstrap/css/src/`;
|
||||
ok( @css_files > 0, 'We should test something' );
|
||||
my @MakeFile = read_file('Makefile.PL');
|
||||
|
||||
my @not_mapped;
|
||||
for my $file (@css_files) {
|
||||
chomp $file;
|
||||
next if $file =~ m{/_[^/]*};
|
||||
my $css = $file;
|
||||
$css =~ s#/css/src/(.*).scss$#/css/$1.css#;
|
||||
unless ( grep { /$css/ } @MakeFile ) {
|
||||
push @not_mapped, $css;
|
||||
}
|
||||
}
|
||||
|
||||
is( @not_mapped, 0, 'All directories should be mapped' . ( @not_mapped ? ': ' . join ',', @not_mapped : '' ) );
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue