Koha/xt/tt_tidy.t
Jonathan Druart e0d93e67f7
Bug 39115: Remove exclude list from tt_tidy.t
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-17 13:10:20 +01:00

52 lines
1.4 KiB
Perl
Executable file

#/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 <http://www.gnu.org/licenses>.
use Modern::Perl;
use threads; # used for parallel
use File::Slurp qw( read_file );
use Test::More;
use Test::Strict;
use Parallel::ForkManager;
use Sys::CPU;
my @tt_files = qx{git ls-files '*.tt' '*.inc'};
$Test::Strict::TEST_STRICT = 0;
my $ncpu;
if ( $ENV{KOHA_PROVE_CPUS} ) {
$ncpu = $ENV{KOHA_PROVE_CPUS};
} else {
$ncpu = Sys::CPU::cpu_count();
}
my $pm = Parallel::ForkManager->new($ncpu);
foreach my $filepath (@tt_files) {
$pm->start and next;
chomp $filepath;
my $tidy = qx{perl misc/devel/tidy.pl --silent --no-write $filepath};
my $content = read_file $filepath;
ok( $content eq $tidy, "$filepath should be kept tidy" );
$pm->finish;
}
$pm->wait_all_children;
done_testing;