Fix SConsignEntry.set_implicit() to handle null strings, too. (Jeff Petkau)
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Thu, 6 Jun 2002 14:46:22 +0000 (14:46 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Thu, 6 Jun 2002 14:46:22 +0000 (14:46 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@385 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/engine/SCons/Sig/SigTests.py
src/engine/SCons/Sig/__init__.py

index 7931947e44535bbb13fedf67d8623d67cbc606bb..365a0d6fcdba2bbd400501dd815f52a8e6fb3a4d 100644 (file)
@@ -502,6 +502,27 @@ class SConsignEntryTestCase(unittest.TestCase):
         assert e.get_implicit() == []
         assert e.render(m) == "987 654 321 "   # note trailing space
 
+       e.set_implicit(None)
+        assert e.get_implicit() == None, e.get_implicit()
+
+       e.set_implicit('')
+        assert e.get_implicit() == [], e.get_implicit()
+
+       e.set_implicit('foo')
+        assert e.get_implicit() == ['foo'], e.get_implicit()
+
+       e.set_implicit('foo bar')
+        assert e.get_implicit() == ['foo bar'], e.get_implicit()
+
+       e.set_implicit(['foo'])
+        assert e.get_implicit() == ['foo'], e.get_implicit()
+
+       e.set_implicit(['foo bar'])
+        assert e.get_implicit() == ['foo bar'], e.get_implicit()
+
+       e.set_implicit(['foo', 'bar'])
+        assert e.get_implicit() == ['foo', 'bar'], e.get_implicit()
+
 class SConsignFileTestCase(unittest.TestCase):
 
     def runTest(self):
index a13557afca67e51d4d13776ec7cf39c0a0989816..c97f81e73ae43f6c8487e755bfcbff191933336f 100644 (file)
@@ -91,9 +91,11 @@ class SConsignEntry:
             return string.split(self.implicit, '\0')
 
     def set_implicit(self, implicit):
-        if not implicit:
+        if implicit is None:
             self.implicit = None
         else:
+           if SCons.Util.is_String(implicit):
+               implicit = [implicit]
             self.implicit = string.join(map(str, implicit), '\0')