]> err.no Git - dak/commitdiff
Fix lintian regex.
authorChris Lamb <lamby@debian.org>
Wed, 28 Oct 2009 09:13:38 +0000 (09:13 +0000)
committerChris Lamb <lamby@debian.org>
Wed, 28 Oct 2009 09:13:44 +0000 (09:13 +0000)
Signed-off-by: Chris Lamb <lamby@debian.org>
daklib/regexes.py
tests/test_regexes.py

index cc5d1be6873de251852e92b0e85d8e1a7900f3e1..6be999771acabbd41ff2926061a5cbde9ad1f1a6 100755 (executable)
@@ -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): (.*?): ([^ ]*) ?(.*)$")
index 2f8fed1e87af2076b065e5e7c4c40f94d3243153..766e73e49070a86fe798498aee38d9d9d29669dd 100755 (executable)
@@ -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__':