Bugzilla – Attachment 177813 Details for
Bug 38664
Tidy the whole codebase
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38664: Add a xt test for TT files
Bug-38664-Add-a-xt-test-for-TT-files.patch (text/plain), 2.77 KB, created by
Jonathan Druart
on 2025-02-11 22:43:35 UTC
(
hide
)
Description:
Bug 38664: Add a xt test for TT files
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2025-02-11 22:43:35 UTC
Size:
2.77 KB
patch
obsolete
>From 6daf09496ab37a8b2a57d2791a87ea120b077480 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 11 Feb 2025 23:14:41 +0100 >Subject: [PATCH] Bug 38664: Add a xt test for TT files > >--- > misc/devel/tidy.pl | 3 +-- > xt/tt_tidy.t | 53 ++++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 54 insertions(+), 2 deletions(-) > create mode 100644 xt/tt_tidy.t > >diff --git a/misc/devel/tidy.pl b/misc/devel/tidy.pl >index 88b53f88658..c3f22e635ea 100755 >--- a/misc/devel/tidy.pl >+++ b/misc/devel/tidy.pl >@@ -50,7 +50,6 @@ my @exceptions = qw( > misc/cronjobs/rss/lastAcquired-2.0.tt > misc/cronjobs/rss/longestUnseen.tt > misc/cronjobs/rss/mostReserved.tt >- t/db_dependent/misc/translator/sample.tt > ); > > @files = array_minus( @files, @exceptions ); >@@ -121,7 +120,7 @@ sub get_js_files { > } > > sub get_tt_files { >- my @files = qx{git ls-files '*.tt' '*.inc' ':(exclude)Koha/ILL/Backend/' ':(exclude)doc-head-open.inc'}; >+ my @files = qx{git ls-files '*.tt' '*.inc' ':(exclude)Koha/ILL/Backend/' ':(exclude)*doc-head-open.inc'}; > chomp for @files; > return @files; > } >diff --git a/xt/tt_tidy.t b/xt/tt_tidy.t >new file mode 100644 >index 00000000000..dfb3de2f8cf >--- /dev/null >+++ b/xt/tt_tidy.t >@@ -0,0 +1,53 @@ >+#/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' ':(exclude)Koha/ILL/Backend/' ':(exclude)*doc-head-open.inc' ':(exclude)misc/cronjobs/rss'}; >+ >+$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; >-- >2.34.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 38664
:
175488
|
175664
|
177755
|
177796
|
177797
|
177798
|
177799
|
177800
|
177801
|
177802
| 177813 |
177825
|
177826
|
177827