summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGary Oberbrunner <garyo@oberbrunner.com>2013-09-29 19:50:32 (GMT)
committerGary Oberbrunner <garyo@oberbrunner.com>2013-09-29 19:50:32 (GMT)
commitb20c2218feb24b73a3d985b1f8121e601e930f45 (patch)
tree0a6f64ad3b343a528fecc08d6820f6e84df6cbec
parent40e8adb05f3a2ef817d3bbd4590991427c5a98a1 (diff)
downloadSCons-b20c2218feb24b73a3d985b1f8121e601e930f45.zip
SCons-b20c2218feb24b73a3d985b1f8121e601e930f45.tar.gz
SCons-b20c2218feb24b73a3d985b1f8121e601e930f45.tar.bz2
Added tests for Literal object comparison, and updated CHANGES.txt.
-rw-r--r--src/CHANGES.txt4
-rw-r--r--src/engine/SCons/EnvironmentTests.py8
-rw-r--r--src/engine/SCons/SubstTests.py5
3 files changed, 16 insertions, 1 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index e80a161..dd6a717 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -6,6 +6,10 @@
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.
diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py
index 45cf876..db788dc 100644
--- a/src/engine/SCons/EnvironmentTests.py
+++ b/src/engine/SCons/EnvironmentTests.py
@@ -1682,6 +1682,8 @@ def exists(env):
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
@@ -1694,7 +1696,9 @@ def exists(env):
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']
@@ -1709,6 +1713,8 @@ def exists(env):
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
diff --git a/src/engine/SCons/SubstTests.py b/src/engine/SCons/SubstTests.py
index 420fd73..ee9f3db 100644
--- a/src/engine/SCons/SubstTests.py
+++ b/src/engine/SCons/SubstTests.py
@@ -1147,6 +1147,11 @@ class LiteralTestCase(unittest.TestCase):
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."""