From 983c1bc74c8e036bc5ae6d9646474d8acbc9a112 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Thu, 18 May 2017 00:12:01 +0200 Subject: Test::Dpkg: Add new all_perl_modules function --- debian/changelog | 1 + scripts/Test/Dpkg.pm | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 9ece8fac0..5dc0bdeb9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -13,6 +13,7 @@ dpkg (1.19.0) UNRELEASED; urgency=medium - Enable perlcritic Documentation::RequirePodSections and Miscellanea::ProhibitTies. - Disable perlcritic ValuesAndExpressions::ProhibitEscapedCharacter. + - Add a new all_perl_modules function to Test::Dpkg. -- Guillem Jover Thu, 18 May 2017 05:27:31 +0200 diff --git a/scripts/Test/Dpkg.pm b/scripts/Test/Dpkg.pm index ba0f5394c..1b1a5d67e 100644 --- a/scripts/Test/Dpkg.pm +++ b/scripts/Test/Dpkg.pm @@ -21,6 +21,7 @@ use warnings; our $VERSION = '0.00'; our @EXPORT_OK = qw( all_perl_files + all_perl_modules test_get_perl_dirs test_get_data_path test_needs_author @@ -38,6 +39,7 @@ our %EXPORT_TAGS = ( ) ], paths => [ qw( all_perl_files + all_perl_modules test_get_perl_dirs test_get_data_path ) ], @@ -63,9 +65,10 @@ sub test_get_perl_dirs sub all_perl_files { + my $filter = shift // qr/\.(?:pl|pm|t)$/; my @files; my $scan_perl_files = sub { - push @files, $File::Find::name if m/\.(pl|pm|t)$/; + push @files, $File::Find::name if m/$filter/; }; find($scan_perl_files, test_get_perl_dirs()); @@ -73,6 +76,11 @@ sub all_perl_files return @files; } +sub all_perl_modules +{ + return all_perl_files(qr/\.pm$/); +} + sub test_needs_author { if (not $ENV{DPKG_DEVEL_MODE} and not $ENV{AUTHOR_TESTING}) { -- cgit v1.2.3