X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=tests%2Ftest_lintian.py;fp=tests%2Ftest_lintian.py;h=99d5e93ab33d3653a20257faeeec9778b4aeceda;hb=6929479f75234f9a4c88ce6f297d6a7b070753f6;hp=0000000000000000000000000000000000000000;hpb=ba4056eaffdde2acaf8c6281cf8ba4b3e1da2bd5;p=dak.git diff --git a/tests/test_lintian.py b/tests/test_lintian.py new file mode 100755 index 00000000..99d5e93a --- /dev/null +++ b/tests/test_lintian.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python + +from base_test import DakTestCase + +import unittest + +from daklib.lintian import parse_lintian_output + +class ParseLintianTestCase(DakTestCase): + def assertParse(self, output, expected): + self.assertEqual( + list(parse_lintian_output(output)), + expected, + ) + + def testSimple(self): + self.assertParse( + 'W: pkgname: some-tag path/to/file', + [('W', 'pkgname', 'some-tag', 'path/to/file')], + ) + + self.assertParse('', []) + self.assertParse('\n\n', []) + self.assertParse('dummy error test', []) + + def testBinaryNoDescription(self): + self.assertParse( + 'W: pkgname: some-tag', + [('W', 'pkgname', 'some-tag', '')], + ) + + def testSource(self): + self.assertParse( + 'W: pkgname source: some-tag', + [('W', 'pkgname source', 'some-tag', '')] + ) + + def testSourceNoDescription(self): + self.assertParse( + 'W: pkgname source: some-tag path/to/file', + [('W', 'pkgname source', 'some-tag', 'path/to/file')] + ) + +if __name__ == '__main__': + unittest.main()