summaryrefslogtreecommitdiffstats
path: root/python/macholib/macholib_tests/test_dylib.py
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /python/macholib/macholib_tests/test_dylib.py
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'python/macholib/macholib_tests/test_dylib.py')
-rw-r--r--python/macholib/macholib_tests/test_dylib.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/python/macholib/macholib_tests/test_dylib.py b/python/macholib/macholib_tests/test_dylib.py
new file mode 100644
index 000000000..dcbc45358
--- /dev/null
+++ b/python/macholib/macholib_tests/test_dylib.py
@@ -0,0 +1,38 @@
+from macholib import dylib
+
+import sys
+if sys.version_info[:2] <= (2,6):
+ import unittest2 as unittest
+else:
+ import unittest
+
+def d(location=None, name=None, shortname=None, version=None, suffix=None):
+ return dict(
+ location=location,
+ name=name,
+ shortname=shortname,
+ version=version,
+ suffix=suffix
+ )
+
+class TestDylib (unittest.TestCase):
+ def testInvalid(self):
+ self.assertTrue(dylib.dylib_info('completely/invalid') is None)
+ self.assertTrue(dylib.dylib_info('completely/invalid_debug') is None)
+
+ def testUnversioned(self):
+ self.assertEqual(dylib.dylib_info('P/Foo.dylib'),
+ d('P', 'Foo.dylib', 'Foo'))
+ self.assertEqual(dylib.dylib_info('P/Foo_debug.dylib'),
+ d('P', 'Foo_debug.dylib', 'Foo', suffix='debug'))
+
+ def testVersioned(self):
+ self.assertEqual(dylib.dylib_info('P/Foo.A.dylib'),
+ d('P', 'Foo.A.dylib', 'Foo', 'A'))
+ self.assertEqual(dylib.dylib_info('P/Foo_debug.A.dylib'),
+ d('P', 'Foo_debug.A.dylib', 'Foo_debug', 'A'))
+ self.assertEqual(dylib.dylib_info('P/Foo.A_debug.dylib'),
+ d('P', 'Foo.A_debug.dylib', 'Foo', 'A', 'debug'))
+
+if __name__ == "__main__":
+ unittest.main()