From 143c1741a54e4e5dae6792dfbd7d250fa8022453 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 18 Jul 2025 14:43:00 +0200 Subject: [PATCH] Bug 40315: Remove warnings from xt/tt_tidy.t Maybe we could remove the warnings from misc/devel/tidy.pl if the file was originally empty but for now it feels safer to skip the tidy of empty files Test plan: prove xt/tt_tidy.t xt/use-test-no-warnings.t should return green Signed-off-by: David Nind --- xt/tt_tidy.t | 17 ++++++++++++----- xt/use-test-no-warnings.t | 3 --- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/xt/tt_tidy.t b/xt/tt_tidy.t index 895c26be7d4..c5e3ecbae1b 100755 --- a/xt/tt_tidy.t +++ b/xt/tt_tidy.t @@ -19,6 +19,7 @@ use Modern::Perl; use threads; # used for parallel use File::Slurp qw( read_file ); use Test::More; +use Test::NoWarnings; use Test::Strict; use Parallel::ForkManager; use Sys::CPU; @@ -39,16 +40,22 @@ if ( $ENV{KOHA_PROVE_CPUS} ) { my $pm = Parallel::ForkManager->new($ncpu); +plan tests => scalar(@tt_files) + 1; + foreach my $filepath (@tt_files) { $pm->start and next; - 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" ); + if ( !-s $filepath ) { + + # Do not tidy empty files + ok(1); + } else { + 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; diff --git a/xt/use-test-no-warnings.t b/xt/use-test-no-warnings.t index d74e5f25482..211c11dcbed 100755 --- a/xt/use-test-no-warnings.t +++ b/xt/use-test-no-warnings.t @@ -52,9 +52,6 @@ my @exceptions = ( # bug 40449 "xt/author/valid-templates.t", - - # bug 40315 - "xt/tt_tidy.t", ); @t_files = array_minus( @t_files, @exceptions ); -- 2.39.5