From 4cff090b397522d91a4e3c3fe64746743338baab Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 24 Apr 2025 11:45:43 -0300 Subject: [PATCH] Bug 39741: Make valid-templates.t handle dirs This patch changes the regex so it doesn't expect the exclusion parameters to only be files but accept directories too. The risk of this is we might at some point catch more than we want. I don't think it is worth spending more time in it, though. To test: 1. Run: $ ktd --shell k$ prove xt/author/valid-templates.t => SUCCESS: Tests pass! 2. Apply this patch 3. Repeat 1 => SUCCESS: Tests pass! We don't need to list each individual file anymore and it will still work! 4. Sign off :-D Signed-off-by: Tomas Cohen Arazi Signed-off-by: David Nind --- xt/author/valid-templates.t | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/xt/author/valid-templates.t b/xt/author/valid-templates.t index fbbf03c2c4..a8cc379b70 100755 --- a/xt/author/valid-templates.t +++ b/xt/author/valid-templates.t @@ -84,34 +84,20 @@ foreach my $theme (@themes) { $theme->{'modules'}, $theme->{'includes'}, - # templates to exclude from testing because + # templates or dirs to exclude from testing because # they cannot stand alone 'doc-head-close.inc', 'opac-bottom.inc', - 'ill/backends/Standard/shared/forms/article.inc', - 'ill/backends/Standard/shared/forms/book.inc', - 'ill/backends/Standard/shared/forms/chapter.inc', - 'ill/backends/Standard/shared/forms/conference.inc', - 'ill/backends/Standard/shared/forms/dvd.inc', - 'ill/backends/Standard/shared/forms/journal.inc', - 'ill/backends/Standard/shared/forms/resource.inc', - 'ill/backends/Standard/shared/forms/thesis.inc', + 'ill/backends/Standard/shared/forms', ); } else { run_template_test( $theme->{'modules'}, $theme->{'includes'}, - # templates to exclude from testing because + # templates or dirs to exclude from testing because # they cannot stand alone - 'ill/backends/Standard/shared/forms/article.inc', - 'ill/backends/Standard/shared/forms/book.inc', - 'ill/backends/Standard/shared/forms/chapter.inc', - 'ill/backends/Standard/shared/forms/conference.inc', - 'ill/backends/Standard/shared/forms/dvd.inc', - 'ill/backends/Standard/shared/forms/journal.inc', - 'ill/backends/Standard/shared/forms/resource.inc', - 'ill/backends/Standard/shared/forms/thesis.inc', + 'ill/backends/Standard/shared/forms' ); } $pm->finish; @@ -150,7 +136,7 @@ sub create_template_test { } ); foreach my $exclusion (@exclusions) { - if ( $_ =~ /${exclusion}$/ ) { + if ( $_ =~ /${exclusion}/ ) { diag("excluding template $_ because it cannot stand on its own"); return; } -- 2.39.5