summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/Options
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/SCons/Options')
-rw-r--r--src/engine/SCons/Options/ListOption.py4
-rw-r--r--src/engine/SCons/Options/ListOptionTests.py3
-rw-r--r--src/engine/SCons/Options/OptionsTests.py13
-rw-r--r--src/engine/SCons/Options/__init__.py6
4 files changed, 20 insertions, 6 deletions
diff --git a/src/engine/SCons/Options/ListOption.py b/src/engine/SCons/Options/ListOption.py
index d14b22a..5aa508a 100644
--- a/src/engine/SCons/Options/ListOption.py
+++ b/src/engine/SCons/Options/ListOption.py
@@ -65,7 +65,7 @@ class _ListOption(UserList.UserList):
UserList.UserList.__init__(self, filter(None, initlist))
self.allowedElems = allowedElems[:]
self.allowedElems.sort()
-
+
def __cmp__(self, other):
raise NotImplementedError
def __eq__(self, other):
@@ -88,7 +88,7 @@ class _ListOption(UserList.UserList):
return string.join(self, ',')
def __repr__(self):
return self.__str__()
-
+
def _converter(val, allowedElems, mapdict):
"""
"""
diff --git a/src/engine/SCons/Options/ListOptionTests.py b/src/engine/SCons/Options/ListOptionTests.py
index a892e18..22378bc 100644
--- a/src/engine/SCons/Options/ListOptionTests.py
+++ b/src/engine/SCons/Options/ListOptionTests.py
@@ -122,9 +122,6 @@ class ListOptionTestCase(unittest.TestCase):
l = o.converter('all')
n = l.__class__(copy.copy(l))
- def test___repr__(self):
- """Test copying a ListOption like an Environment would"""
-
if __name__ == "__main__":
suite = unittest.makeSuite(ListOptionTestCase, 'test_')
if not unittest.TextTestRunner().run(suite).wasSuccessful():
diff --git a/src/engine/SCons/Options/OptionsTests.py b/src/engine/SCons/Options/OptionsTests.py
index aeffe2d..1d9b851 100644
--- a/src/engine/SCons/Options/OptionsTests.py
+++ b/src/engine/SCons/Options/OptionsTests.py
@@ -59,6 +59,19 @@ def checkSave(file, expected):
class OptionsTestCase(unittest.TestCase):
+ def test_keys(self):
+ """Test the Options.keys() method"""
+ opts = SCons.Options.Options()
+
+ opts.Add('VAR1')
+ opts.Add('VAR2',
+ 'THE answer to THE question',
+ "42",
+ check,
+ lambda x: int(x) + 12)
+ keys = opts.keys()
+ assert keys == ['VAR1', 'VAR2'], keys
+
def test_Add(self):
"""Test adding to an Options object"""
opts = SCons.Options.Options()
diff --git a/src/engine/SCons/Options/__init__.py b/src/engine/SCons/Options/__init__.py
index 7333985..83798b3 100644
--- a/src/engine/SCons/Options/__init__.py
+++ b/src/engine/SCons/Options/__init__.py
@@ -76,6 +76,11 @@ class Options:
self.options.append(option)
+ def keys(self):
+ """
+ Returns the keywords for the options
+ """
+ return map(lambda o: o.key, self.options)
def Add(self, key, help="", default=None, validator=None, converter=None, **kw):
"""
@@ -100,7 +105,6 @@ class Options:
self._do_add(key, help, default, validator, converter)
-
def AddOptions(self, *optlist):
"""
Add a list of options.