summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorTarek Ziadé <ziade.tarek@gmail.com>2009-04-12 16:31:24 (GMT)
committerTarek Ziadé <ziade.tarek@gmail.com>2009-04-12 16:31:24 (GMT)
commitf6f4b3084c65acde658bded07a020e8c3e446dfa (patch)
treec745e60819c6db23f2b2f2e4df339edb5a1a9628 /Lib
parent7bea344d35dc43642184c00e6cae6d1c396e721b (diff)
downloadcpython-f6f4b3084c65acde658bded07a020e8c3e446dfa.zip
cpython-f6f4b3084c65acde658bded07a020e8c3e446dfa.tar.gz
cpython-f6f4b3084c65acde658bded07a020e8c3e446dfa.tar.bz2
added a simple test for search_cpp
Diffstat (limited to 'Lib')
-rw-r--r--Lib/distutils/command/config.py5
-rw-r--r--Lib/distutils/tests/test_config_cmd.py15
2 files changed, 15 insertions, 5 deletions
diff --git a/Lib/distutils/command/config.py b/Lib/distutils/command/config.py
index 74eed78..43a8dc8 100644
--- a/Lib/distutils/command/config.py
+++ b/Lib/distutils/command/config.py
@@ -202,11 +202,10 @@ class config(Command):
preprocesses an empty file -- which can be useful to determine the
symbols the preprocessor and compiler set by default.
"""
-
self._check_compiler()
- (src, out) = self._preprocess(body, headers, include_dirs, lang)
+ src, out = self._preprocess(body, headers, include_dirs, lang)
- if type(pattern) is StringType:
+ if isinstance(pattern, str):
pattern = re.compile(pattern)
file = open(out)
diff --git a/Lib/distutils/tests/test_config_cmd.py b/Lib/distutils/tests/test_config_cmd.py
index 6fd1776..af16d4c 100644
--- a/Lib/distutils/tests/test_config_cmd.py
+++ b/Lib/distutils/tests/test_config_cmd.py
@@ -2,7 +2,7 @@
import unittest
import os
-from distutils.command.config import dump_file
+from distutils.command.config import dump_file, config
from distutils.tests import support
from distutils import log
@@ -10,7 +10,7 @@ class ConfigTestCase(support.LoggingSilencer,
support.TempdirManager,
unittest.TestCase):
- def _info(self, msg):
+ def _info(self, msg, *args):
for line in msg.splitlines():
self._logs.append(line)
@@ -35,6 +35,17 @@ class ConfigTestCase(support.LoggingSilencer,
dump_file(this_file, 'I am the header')
self.assertEquals(len(self._logs), numlines+1)
+ def test_search_cpp(self):
+ pkg_dir, dist = self.create_dist()
+ cmd = config(dist)
+
+ # simple pattern searches
+ match = cmd.search_cpp(pattern='xxx', body='// xxx')
+ self.assertEquals(match, 0)
+
+ match = cmd.search_cpp(pattern='command', body='// xxx')
+ self.assertEquals(match, 1)
+
def test_suite():
return unittest.makeSuite(ConfigTestCase)