This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch main in repository dpkg.
View the commit online: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=0c9f0bc0749a71b4352c2fb5b0c48da4498507f1 commit 0c9f0bc0749a71b4352c2fb5b0c48da4498507f1 (HEAD -> main) Author: Guillem Jover <[email protected]> AuthorDate: Wed Oct 12 01:31:22 2022 +0200 Test::Dpkg: Refactor test files search into _test_get_files function() This reduces duplication and will make adding new variants easier. --- scripts/Test/Dpkg.pm | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/scripts/Test/Dpkg.pm b/scripts/Test/Dpkg.pm index a756c79c6..9a75c0420 100644 --- a/scripts/Test/Dpkg.pm +++ b/scripts/Test/Dpkg.pm @@ -116,35 +116,32 @@ sub test_get_perl_dirs } } -sub all_po_files +sub _test_get_files { - my $filter = shift // qr/\.(?:po|pot)$/; + my ($filter, $dirs) = @_; my @files; - my $scan_po_files = sub { + my $scan_files = sub { push @files, $File::Find::name if m/$filter/; }; - find($scan_po_files, test_get_po_dirs()); + find($scan_files, @{$dirs}); return @files; } -sub all_perl_files +sub all_po_files { - my $filter = shift // qr/\.(?:PL|pl|pm|t)$/; - my @files; - my $scan_perl_files = sub { - push @files, $File::Find::name if m/$filter/; - }; - - find($scan_perl_files, test_get_perl_dirs()); + return _test_get_files(qr/\.(?:po|pot)$/, [ test_get_po_dirs() ]); +} - return @files; +sub all_perl_files +{ + return _test_get_files(qr/\.(?:PL|pl|pm|t)$/, [ test_get_perl_dirs() ]); } sub all_perl_modules { - return all_perl_files(qr/\.pm$/); + return _test_get_files(qr/\.pm$/, [ test_get_perl_dirs() ]); } sub test_needs_author -- Dpkg.Org's dpkg

