Commits

Gary Oberbrunner committed 4c1ba6f

Added tests for Literal object comparison, and updated CHANGES.txt.

  • Participants
  • Parent commits 5702683

Comments (0)

Files changed (3)

 
 RELEASE 2.3.1.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE
 
+  From Manuel Francisco Naranjo:
+    - Allow Subst.Literal string objects to be compared with each other,
+      so they work better in AddUnique() and Remove().
+
   From David Rothenberger:
     - Added cyglink linker that uses Cygwin naming conventions for
       shared libraries and automatically generates import libraries.

src/engine/SCons/EnvironmentTests.py

                           CCC1 = '',
                           CCC2 = '',
                           DDD1 = ['a', 'b', 'c'])
+        env['LL1'] = [env.Literal('a literal'), env.Literal('b literal')]
+        env['LL2'] = [env.Literal('c literal'), env.Literal('b literal')]
         env.AppendUnique(AAA1 = 'a1',
                          AAA2 = ['a2'],
                          AAA3 = ['a3', 'b', 'c', 'c', 'b', 'a3'], # ignore dups
                          BBB5 = ['b5.new'],
                          CCC1 = 'c1',
                          CCC2 = ['c2'],
-                         DDD1 = 'b')
+                         DDD1 = 'b',
+                         LL1  = env.Literal('a literal'),
+                         LL2  = env.Literal('a literal'))
 
         assert env['AAA1'] == 'a1a1', env['AAA1']
         assert env['AAA2'] == ['a2'], env['AAA2']
         assert env['CCC1'] == 'c1', env['CCC1']
         assert env['CCC2'] == ['c2'], env['CCC2']
         assert env['DDD1'] == ['a', 'b', 'c'], env['DDD1']
+        assert env['LL1']  == [env.Literal('a literal'), env.Literal('b literal')], env['LL1']
+        assert env['LL2']  == [env.Literal('c literal'), env.Literal('b literal'), env.Literal('a literal')], [str(x) for x in env['LL2']]
 
         env.AppendUnique(DDD1 = 'b', delete_existing=1)
         assert env['DDD1'] == ['a', 'c', 'b'], env['DDD1'] # b moves to end

src/engine/SCons/SubstTests.py

         cmd_list = escape_list(cmd_list[0], escape_func)
         assert cmd_list == ['BAZ', '**$BAR**'], cmd_list
 
+    def test_LiteralEqualsTest(self):
+        """Test that Literals compare for equality properly"""
+        assert Literal('a literal') == Literal('a literal')
+        assert Literal('a literal') != Literal('b literal')
+
 class SpecialAttrWrapperTestCase(unittest.TestCase):
     def test_SpecialAttrWrapper(self):
         """Test the SpecialAttrWrapper() function."""