Subject: | Remove unneeded (?&PerlOWS) in tests |
Date: | Tue, 3 Jul 2018 17:44:07 -0700 |
To: | bug-ppr [...] rt.cpan.org |
From: | Adriano Ferreira <a.r.ferreira [...] gmail.com> |
With the latest changes that made sure PerlDocument and PerlStatement
include leading and trailing spaces + POD, the regexes in some tests may be
simplified – which may be good from the point of view of learning PPR from
the tests. Those changes look like
-ok $JAPH =~ m{ \A (?&PerlOWS) (?&PerlDocument) (?&PerlOWS) \Z $PPR::GRAMMAR
}xms
+ok $JAPH =~ m{ \A (?&PerlDocument) \Z $PPR::GRAMMAR }xms
Also attached patch touches two tests:
*t/yadayadayada.t* where using \A and \Z instead of ^ and $ looks safer:
*--- a/t/yadayadayada.t*
*+++ b/t/yadayadayada.t*
@@ -15,7 +15,7 @@ plan tests => 3;
use PPR;
my $Perl_document = qr{
- ^ (?&PerlDocument) $ $PPR::GRAMMAR
+ \A (?&PerlDocument) \Z $PPR::GRAMMAR
}xms;
ok 'sub foo {...}' =~ $Perl_document => 'Pure
yada';
and *t/disapproval.t where replacing PerlStatement with PerlDocument makes
the test to validate the entire test file:*
*--- a/t/disapproval.t*
*+++ b/t/disapproval.t*
@@ -28,7 +28,7 @@ local $SIG{__WARN__} = sub {
open my $own_file, '<:encoding(utf8)', $0 or die $!;
my $own_code = do { local $/; readline($own_file); };
-ok $own_code =~ m{ ^ (?&PerlOWS) (?&PerlStatement) (?&PerlOWS) $
$PPR::GRAMMAR
}xm
+ok $own_code =~ m{ \A (?&PerlDocument) \Z $PPR::GRAMMAR }xm
=> 'Matched code with the look of disapproval!';
Message body is not shown because it is too large.
Message body is not shown because sender requested not to inline it.