Add unit test for pkg_check_modules with whitespace

This commit is contained in:
Brett T. Warden
2018-09-05 13:31:58 -07:00
committed by William Douglas
parent 8ab07d0e0d
commit 30a2528f95
+14
View File
@@ -450,6 +450,20 @@ class TestBuildreq(unittest.TestCase):
self.assertEqual(buildreq.buildreqs,
set(['pkgconfig(gio-unix-2.0)', 'pkgconfig(glib-2.0)']))
def test_parse_cmake_pkg_check_modules_whitespace(self):
"""
Test parse_cmake to ensure accurate handling of versioned
pkgconfig modules with whitespace.
"""
content = 'pkg_check_modules(GLIB gio-unix-2.0 >= 2.46.0 glib-2.0 REQUIRED)'
with tempfile.TemporaryDirectory() as tmpd:
with open(os.path.join(tmpd, 'fname'), 'w') as f:
f.write(content)
buildreq.parse_cmake(os.path.join(tmpd, 'fname'))
self.assertEqual(buildreq.buildreqs,
set(['pkgconfig(gio-unix-2.0)', 'pkgconfig(glib-2.0)']))
if __name__ == '__main__':
unittest.main(buffer=True)