From bf95947fa726554611637159e14e0a44ff7ce50a Mon Sep 17 00:00:00 2001 From: Chris Lamb Date: Wed, 28 Oct 2009 09:13:38 +0000 Subject: [PATCH] Fix lintian regex. Signed-off-by: Chris Lamb --- daklib/regexes.py | 2 +- tests/test_regexes.py | 24 +++++++++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/daklib/regexes.py b/daklib/regexes.py index cc5d1be6..6be99977 100755 --- a/daklib/regexes.py +++ b/daklib/regexes.py @@ -112,4 +112,4 @@ re_user_mails = re.compile(r"^(pub|uid):[^rdin].*<(.*@.*)>.*$", re.MULTILINE); re_user_name = re.compile(r"^pub:.*:(.*)<.*$", re.MULTILINE); re_re_mark = re.compile(r'^RE:') -re_parse_lintian = re.compile(r"^(W|E|O): (.*?): (.*?) (.*)$") +re_parse_lintian = re.compile(r"^(W|E|O): (.*?): ([^ ]*) ?(.*)$") diff --git a/tests/test_regexes.py b/tests/test_regexes.py index 2f8fed1e..766e73e4 100755 --- a/tests/test_regexes.py +++ b/tests/test_regexes.py @@ -35,10 +35,28 @@ class re_single_line_field(unittest.TestCase): class re_parse_lintian(unittest.TestCase): MATCH = regexes.re_parse_lintian.match - def testSimple(self): + def testBinary(self): + self.assertEqual( + self.MATCH('W: pkgname: some-tag path/to/file').groups(), + ('W', 'pkgname', 'some-tag', 'path/to/file') + ) + + def testBinaryNoDescription(self): + self.assertEqual( + self.MATCH('W: pkgname: some-tag').groups(), + ('W', 'pkgname', 'some-tag', '') + ) + + def testSource(self): + self.assertEqual( + self.MATCH('W: pkgname source: some-tag').groups(), + ('W', 'pkgname source', 'some-tag', '') + ) + + def testSourceNoDescription(self): self.assertEqual( - self.MATCH('W: tzdata: binary-without-manpage usr/sbin/tzconfig').groups(), - ('W', 'tzdata', 'binary-without-manpage', 'usr/sbin/tzconfig') + self.MATCH('W: pkgname source: some-tag path/to/file').groups(), + ('W', 'pkgname source', 'some-tag', 'path/to/file') ) if __name__ == '__main__': -- 2.39.2