diff options
author | Richard Dale <richard.dale@codethink.co.uk> | 2013-05-21 11:11:04 +0100 |
---|---|---|
committer | Richard Dale <richard.dale@codethink.co.uk> | 2013-05-29 16:13:48 +0100 |
commit | 70f21759d03cfc930d26f8abac0d56a8279276b8 (patch) | |
tree | 54fd95dd8450536cc8c359498227c52ce5964a2d /morphlib/buildsystem_tests.py | |
parent | 5a29d98c43fdb637947af893b8604b5d6adcd113 (diff) | |
download | morph-70f21759d03cfc930d26f8abac0d56a8279276b8.tar.gz |
Add detection for cmake and qmake build systems
Add tests for cmake and qmake build systems
Diffstat (limited to 'morphlib/buildsystem_tests.py')
-rw-r--r-- | morphlib/buildsystem_tests.py | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/morphlib/buildsystem_tests.py b/morphlib/buildsystem_tests.py index d1095037..f5505ddd 100644 --- a/morphlib/buildsystem_tests.py +++ b/morphlib/buildsystem_tests.py @@ -28,6 +28,8 @@ def touch(pathname): manual_project = [] autotools_project = ['configure.in'] +qmake_project = ['foo.pro'] +cmake_project = ['CMakeLists.txt'] class BuildSystemTests(unittest.TestCase): @@ -64,6 +66,12 @@ class ManualBuildSystemTests(unittest.TestCase): def test_does_not_autodetect_autotools(self): self.assertFalse(self.bs.used_by_project(autotools_project)) + def test_does_not_autodetect_qmake(self): + self.assertFalse(self.bs.used_by_project(qmake_project)) + + def test_does_not_autodetect_cmake(self): + self.assertFalse(self.bs.used_by_project(cmake_project)) + class DummyBuildSystemTests(unittest.TestCase): @@ -76,6 +84,12 @@ class DummyBuildSystemTests(unittest.TestCase): def test_does_not_autodetect_autotools(self): self.assertFalse(self.bs.used_by_project(autotools_project)) + def test_does_not_autodetect_cmake(self): + self.assertFalse(self.bs.used_by_project(cmake_project)) + + def test_does_not_autodetect_qmake(self): + self.assertFalse(self.bs.used_by_project(qmake_project)) + class AutotoolsBuildSystemTests(unittest.TestCase): @@ -88,6 +102,27 @@ class AutotoolsBuildSystemTests(unittest.TestCase): def test_autodetects_autotools(self): self.assertTrue(self.bs.used_by_project(autotools_project)) +class CMakeBuildSystemTests(unittest.TestCase): + + def setUp(self): + self.bs = morphlib.buildsystem.CMakeBuildSystem() + + def test_does_not_autodetect_empty(self): + self.assertFalse(self.bs.used_by_project(manual_project)) + + def test_autodetects_cmake(self): + self.assertTrue(self.bs.used_by_project(cmake_project)) + +class QMakeBuildSystemTests(unittest.TestCase): + + def setUp(self): + self.bs = morphlib.buildsystem.QMakeBuildSystem() + + def test_does_not_autodetect_empty(self): + self.assertFalse(self.bs.used_by_project(manual_project)) + + def test_autodetects_qmake(self): + self.assertTrue(self.bs.used_by_project(qmake_project)) class DetectBuildSystemTests(unittest.TestCase): @@ -99,6 +134,14 @@ class DetectBuildSystemTests(unittest.TestCase): bs = morphlib.buildsystem.detect_build_system(autotools_project) self.assertEqual(type(bs), morphlib.buildsystem.AutotoolsBuildSystem) + def test_autodetects_cmake(self): + bs = morphlib.buildsystem.detect_build_system(cmake_project) + self.assertEqual(type(bs), morphlib.buildsystem.CMakeBuildSystem) + + def test_autodetects_qmake(self): + bs = morphlib.buildsystem.detect_build_system(qmake_project) + self.assertEqual(type(bs), morphlib.buildsystem.QMakeBuildSystem) + class LookupBuildSystemTests(unittest.TestCase): @@ -116,6 +159,14 @@ class LookupBuildSystemTests(unittest.TestCase): self.assertEqual(type(self.lookup('autotools')), morphlib.buildsystem.AutotoolsBuildSystem) + def test_looks_up_cmake(self): + self.assertEqual(type(self.lookup('cmake')), + morphlib.buildsystem.CMakeBuildSystem) + + def test_looks_up_qmake(self): + self.assertEqual(type(self.lookup('qmake')), + morphlib.buildsystem.QMakeBuildSystem) + def test_looks_up_dummy(self): self.assertEqual(type(self.lookup('dummy')), morphlib.buildsystem.DummyBuildSystem) |