summaryrefslogtreecommitdiff
path: root/Lib/distutils/tests
diff options
context:
space:
mode:
authorTarek Ziadé <ziade.tarek@gmail.com>2009-06-16 08:31:01 +0000
committerTarek Ziadé <ziade.tarek@gmail.com>2009-06-16 08:31:01 +0000
commitc1df95e12f50e4e0ac2fb6d17cbf69a6a3d5583c (patch)
tree49af2dd1575bdca739ae6cc8dc84e71c20b2c348 /Lib/distutils/tests
parentfdefc0a5a1b116fdcb34d372fa7f23992f3bdfeb (diff)
downloadcpython-git-c1df95e12f50e4e0ac2fb6d17cbf69a6a3d5583c.tar.gz
starting distutils.ccompiler test coverage and cleanup
Diffstat (limited to 'Lib/distutils/tests')
-rw-r--r--Lib/distutils/tests/test_ccompiler.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/Lib/distutils/tests/test_ccompiler.py b/Lib/distutils/tests/test_ccompiler.py
new file mode 100644
index 0000000000..58c8c5da40
--- /dev/null
+++ b/Lib/distutils/tests/test_ccompiler.py
@@ -0,0 +1,37 @@
+"""Tests for distutils.ccompiler."""
+import os
+import unittest
+
+from distutils.ccompiler import gen_lib_options
+
+class FakeCompiler(object):
+ def library_dir_option(self, dir):
+ return "-L" + dir
+
+ def runtime_library_dir_option(self, dir):
+ return ["-cool", "-R" + dir]
+
+ def find_library_file(self, dirs, lib, debug=0):
+ return 'found'
+
+ def library_option(self, lib):
+ return "-l" + lib
+
+class CCompilerTestCase(unittest.TestCase):
+
+ def test_gen_lib_options(self):
+ compiler = FakeCompiler()
+ libdirs = ['lib1', 'lib2']
+ runlibdirs = ['runlib1']
+ libs = [os.path.join('dir', 'name'), 'name2']
+
+ opts = gen_lib_options(compiler, libdirs, runlibdirs, libs)
+ wanted = ['-Llib1', '-Llib2', '-cool', '-Rrunlib1', 'found',
+ '-lname2']
+ self.assertEquals(opts, wanted)
+
+def test_suite():
+ return unittest.makeSuite(CCompilerTestCase)
+
+if __name__ == "__main__":
+ unittest.main(defaultTest="test_suite")