diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2017-02-02 19:43:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-02 19:43:03 +0200 |
commit | a9c4428c6925c921102e52aeaea1b92ed6914af1 (patch) | |
tree | bf1d3f780a28e732204e24de79caa2d3e8bcb67d /run_unittests.py | |
parent | ccb0580f4f25b02df6acb8c445ebf60f2215dbc7 (diff) | |
parent | 00846ce26d87369043de59e071856668df698b2f (diff) | |
download | meson-a9c4428c6925c921102e52aeaea1b92ed6914af1.zip meson-a9c4428c6925c921102e52aeaea1b92ed6914af1.tar.gz meson-a9c4428c6925c921102e52aeaea1b92ed6914af1.tar.bz2 |
Merge pull request #1342 from centricular/commonpath-py34
Add our own implementation of os.path.commonpath
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-x | run_unittests.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/run_unittests.py b/run_unittests.py index a1d99f3..e8659f4 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -153,6 +153,23 @@ class InternalTests(unittest.TestCase): a = ['-Ldir', '-Lbah'] + a self.assertEqual(a, ['-Ibar', '-Ifoo', '-Ibaz', '-I..', '-I.', '-Ldir', '-Lbah', '-Werror', '-O3', '-O2', '-Wall']) + def test_commonpath(self): + from os.path import sep + commonpath = mesonbuild.mesonlib.commonpath + self.assertRaises(ValueError, commonpath, []) + self.assertEqual(commonpath(['/usr', '/usr']), sep + 'usr') + self.assertEqual(commonpath(['/usr', '/usr/']), sep + 'usr') + self.assertEqual(commonpath(['/usr', '/usr/bin']), sep + 'usr') + self.assertEqual(commonpath(['/usr/', '/usr/bin']), sep + 'usr') + self.assertEqual(commonpath(['/usr/./', '/usr/bin']), sep + 'usr') + self.assertEqual(commonpath(['/usr/bin', '/usr/bin']), sep + 'usr' + sep + 'bin') + self.assertEqual(commonpath(['/usr//bin', '/usr/bin']), sep + 'usr' + sep + 'bin') + self.assertEqual(commonpath(['/usr/./bin', '/usr/bin']), sep + 'usr' + sep + 'bin') + self.assertEqual(commonpath(['/usr/local', '/usr/lib']), sep + 'usr') + self.assertEqual(commonpath(['/usr', '/bin']), sep) + self.assertEqual(commonpath(['/usr', 'bin']), '') + self.assertEqual(commonpath(['blam', 'bin']), '') + class LinuxlikeTests(unittest.TestCase): def setUp(self): |