summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/ActionTests.py
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2004-08-31 02:16:18 (GMT)
committerSteven Knight <knight@baldmt.com>2004-08-31 02:16:18 (GMT)
commit6ea37f7bb442c511270e5a89cd8fbf801c81e8c2 (patch)
tree93a794ffac5d3eb42d53830cd730211437e4a965 /src/engine/SCons/ActionTests.py
parentc0c32fb930d47c02fcdceea5d1759a35c4a92025 (diff)
downloadSCons-6ea37f7bb442c511270e5a89cd8fbf801c81e8c2.zip
SCons-6ea37f7bb442c511270e5a89cd8fbf801c81e8c2.tar.gz
SCons-6ea37f7bb442c511270e5a89cd8fbf801c81e8c2.tar.bz2
Fix comparisons between Action and subclass instances. (Kevin Quick)
Diffstat (limited to 'src/engine/SCons/ActionTests.py')
-rw-r--r--src/engine/SCons/ActionTests.py32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/engine/SCons/ActionTests.py b/src/engine/SCons/ActionTests.py
index 4c1649c..be0b418 100644
--- a/src/engine/SCons/ActionTests.py
+++ b/src/engine/SCons/ActionTests.py
@@ -1521,6 +1521,35 @@ class ActionFactoryTestCase(unittest.TestCase):
assert strfunc_args == [3, 6, 9], strfunc_args
+class ActionCompareTestCase(unittest.TestCase):
+
+ def test_1_solo_name(self):
+ """Test Lazy Cmd Generator Action get_name alone.
+
+ Basically ensures we can locate the builder, comparing it to
+ itself along the way."""
+ bar = SCons.Builder.Builder(action = {})
+ env = Environment( BUILDERS = {'BAR' : bar} )
+ name = bar.get_name(env)
+ assert name == 'BAR', name
+
+ def test_2_multi_name(self):
+ """Test LazyCmdGenerator Action get_name multi builders.
+
+ Ensure that we can compare builders (and thereby actions) to
+ each other safely."""
+ foo = SCons.Builder.Builder(action = '$FOO', suffix = '.foo')
+ bar = SCons.Builder.Builder(action = {})
+ assert foo != bar
+ assert foo.action != bar.action
+ env = Environment( BUILDERS = {'FOO' : foo,
+ 'BAR' : bar} )
+ name = foo.get_name(env)
+ assert name == 'FOO', name
+ name = bar.get_name(env)
+ assert name == 'BAR', name
+
+
if __name__ == "__main__":
suite = unittest.TestSuite()
tclasses = [ ActionTestCase,
@@ -1531,7 +1560,8 @@ if __name__ == "__main__":
ListActionTestCase,
LazyActionTestCase,
ActionCallerTestCase,
- ActionFactoryTestCase ]
+ ActionFactoryTestCase,
+ ActionCompareTestCase ]
for tclass in tclasses:
names = unittest.getTestCaseNames(tclass, 'test_')
suite.addTests(map(tclass, names))