[libparse-debianchangelog-perl] 21/52: Parse::DebianChangelog: Be less trigger-happy about old-format entries
Intrigeri
intrigeri at moszumanska.debian.org
Sun May 24 12:37:27 UTC 2015
This is an automated email from the git hooks/post-receive script.
intrigeri pushed a commit to branch master
in repository libparse-debianchangelog-perl.
commit 86b5eddf189966599e323882c4cc2eb4f6ce3c42
Author: Frank Lichtenheld <frank at lichtenheld.de>
Date: Mon Jul 16 03:25:07 2007 +0200
Parse::DebianChangelog: Be less trigger-happy about old-format entries
We have a very general pattern that will trigger on pretty much
any non-whitespace string alone on a line. That's way too broad and
will probably hide many errors. For now at least require the first
char to be alpha-numeric so it doesn't trigger on stuff like '+0200'.
Add regression test.
---
lib/Parse/DebianChangelog.pm | 2 +-
t/Parse-DebianChangelog.t | 15 ++++++++++++++-
t/examples/misplaced-tz | 12 ++++++++++++
3 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/lib/Parse/DebianChangelog.pm b/lib/Parse/DebianChangelog.pm
index fb5e469..0fc790b 100644
--- a/lib/Parse/DebianChangelog.pm
+++ b/lib/Parse/DebianChangelog.pm
@@ -382,7 +382,7 @@ sub parse {
|| m/^Changes from version (.*) to (.*):/io
|| m/^Changes for [\w.+-]+-[\w.+-]+:?$/io
|| m/^Old Changelog:$/io
- || m/^(?:\d+:)?[\w.+~-]+:?$/o) {
+ || m/^(?:\d+:)?\w[\w.+~-]*:?$/o) {
# save entries on old changelog format verbatim
# we assume the rest of the file will be in old format once we
# hit it for the first time
diff --git a/t/Parse-DebianChangelog.t b/t/Parse-DebianChangelog.t
index 333bcf0..0fea530 100644
--- a/t/Parse-DebianChangelog.t
+++ b/t/Parse-DebianChangelog.t
@@ -14,7 +14,10 @@ use XML::Simple;
BEGIN {
my $no_examples = 3;
- my $no_tests = $no_examples * 13 + 49;
+ my $no_err_examples = 1;
+ my $no_tests = $no_examples * 13
+ + $no_err_examples * 2
+ + 49;
require Test::More;
import Test::More tests => $no_tests, ;
@@ -234,4 +237,14 @@ is( $str_data, $save_data,
"Compare result of parse from string with result of parse from file" );
+foreach my $test (( [ 't/examples/misplaced-tz', 6 ])) {
+ my $file = shift @$test;
+ my $changes = Parse::DebianChangelog->init( { infile => $file,
+ quiet => 1 } );
+ my @errors = $changes->get_parse_errors();
+
+ ok( @errors, 'errors occoured' );
+ is_deeply( [ map { $_->[1] } @errors ], $test, 'check line numbers' );
+
+}
diff --git a/t/examples/misplaced-tz b/t/examples/misplaced-tz
new file mode 100644
index 0000000..39dc8e3
--- /dev/null
+++ b/t/examples/misplaced-tz
@@ -0,0 +1,12 @@
+error-tz (1.1-1) unstable; urgency=low
+
+ *
+
+ -- Frank Lichtenheld <djpig at debian.org> Mon, 16 Jul 2007 02:54:18 +0200
++0200
+
+error-tz (1.0-1) unstable; urgency=low
+
+ *
+
+ -- Frank Lichtenheld <djpig at debian.org> Mon, 16 Jul 2007 02:54:18 +0200
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libparse-debianchangelog-perl.git
More information about the Pkg-perl-cvs-commits
mailing list