-
Notifications
You must be signed in to change notification settings - Fork 2
/
install_cmake_tests.py
executable file
·50 lines (43 loc) · 2.02 KB
/
install_cmake_tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env python3
# pylint: disable=missing-module-docstring
# pylint: disable=missing-class-docstring
# pylint: disable=missing-function-docstring
import unittest
from install_cmake import CMakeInstall, get_cmake_version
class TestMethods(unittest.TestCase):
def test_suitable_release_found(self):
cmake_install = CMakeInstall(None, None)
self.assertFalse(cmake_install.suitable_release_found(""))
self.assertTrue(cmake_install.suitable_release_found(
"Latest Release (3.24.3)"))
self.assertFalse(cmake_install.suitable_release_found(
"Release Candidate (3.25.0-rc4)"))
def test_suitable_release_found_rc_flag(self):
cmake_install = CMakeInstall(None, True)
self.assertFalse(cmake_install.suitable_release_found(""))
self.assertTrue(cmake_install.suitable_release_found(
"Latest Release (3.24.3)"))
self.assertTrue(cmake_install.suitable_release_found(
"Release Candidate (3.25.0-rc4)"))
def test_get_cmake_version(self):
self.assertEqual(get_cmake_version(""), "")
self.assertEqual(get_cmake_version("blah"), "")
self.assertEqual(get_cmake_version("3"), "")
self.assertEqual(get_cmake_version("cmake version 3.18"), "")
self.assertEqual(get_cmake_version(
"cmake version 3.18.4"), "3.18.4")
self.assertEqual(get_cmake_version(
"cmake version 3.19.0-rc3"), "3.19.0-rc3")
self.assertEqual(get_cmake_version(
"cmake version 99.99.99"), "99.99.99")
self.assertEqual(get_cmake_version(
"cmake version 99.99.99-rc99"), "99.99.99-rc99")
self.assertEqual(get_cmake_version(
"cmake version 3.19.0-rc3\n\n"
"CMake suite maintained and supported by Kitware (kitware.com/cmake).\n"), "3.19.0-rc3")
self.assertEqual(get_cmake_version(
"'3.24.3'"), "3.24.3")
self.assertEqual(get_cmake_version(
'"3.24.3"'), "3.24.3")
if __name__ == '__main__':
unittest.main()