summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/PathListTests.py
diff options
context:
space:
mode:
authorGary Oberbrunner <garyo@oberbrunner.com>2012-10-06 21:54:14 (GMT)
committerGary Oberbrunner <garyo@oberbrunner.com>2012-10-06 21:54:14 (GMT)
commit46043901f7a93385e5bb2d3243073bd6c5634ca8 (patch)
tree2fc201359651d7ecfa023316adb26d88c4c726a9 /src/engine/SCons/PathListTests.py
parentf79ad697f90ac1bca6671682e7b3d8b292356733 (diff)
downloadSCons-46043901f7a93385e5bb2d3243073bd6c5634ca8.zip
SCons-46043901f7a93385e5bb2d3243073bd6c5634ca8.tar.gz
SCons-46043901f7a93385e5bb2d3243073bd6c5634ca8.tar.bz2
Fix nested LIBPATH expansion by flattening sequences in subst_path.
Patch from Alexey Klimkin; fixes issue #2660.
Diffstat (limited to 'src/engine/SCons/PathListTests.py')
-rw-r--r--src/engine/SCons/PathListTests.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/engine/SCons/PathListTests.py b/src/engine/SCons/PathListTests.py
index 212c761..e83fc50 100644
--- a/src/engine/SCons/PathListTests.py
+++ b/src/engine/SCons/PathListTests.py
@@ -48,6 +48,8 @@ class subst_pathTestCase(unittest.TestCase):
return s
self.env = FakeEnvironment(AAA = 'aaa', NULL = '')
+ from SCons.Environment import Environment
+ self.env = Environment(AAA = 'aaa', NULL = '')
def test_node(self):
"""Test the subst_path() method on a Node
@@ -120,6 +122,40 @@ class subst_pathTestCase(unittest.TestCase):
assert result == ('aaa',), result
+ def test_list_of_lists(self):
+ """Test the subst_path() method on substitution of nested lists.
+ """
+ pl = SCons.PathList.PathList((['$AAA', '$AAA'], '$NULL'))
+ result = pl.subst_path(self.env, 'y', 'z')
+ assert result == ('aaa', 'aaa'), result
+
+ def test_subst_nested(self):
+ """Test the subst_path() method on nested substitution of strings.
+ """
+ self.env.Append(L1 = ['a', 'b'],
+ L2 = ['c', 'd'],
+ L3 = ['$L2'])
+ pl = SCons.PathList.PathList(['$L1'])
+ result = pl.subst_path(self.env, 'y', 'z')
+ assert result == ('a', 'b'), result
+ self.env.Append(L1 = ['$L2'])
+ pl = SCons.PathList.PathList(['$L1'])
+ result = pl.subst_path(self.env, 'y', 'z')
+ assert result == ('a', 'b', 'c', 'd'), result
+ self.env.Append(L1 = ['$L3'])
+ pl = SCons.PathList.PathList(['$L1'])
+ result = pl.subst_path(self.env, 'y', 'z')
+ assert result == ('a', 'b', 'c', 'd', 'c', 'd'), result
+
+ def test_another_env(self):
+ """Test the subst_path does lazy evaluation.
+ """
+ pl = SCons.PathList.PathList(('$AAA', '$NULL'))
+ result = pl.subst_path(self.env, 'y', 'z')
+ assert result == ('aaa',), result
+ e = self.env.Clone(AAA = 'bbb')
+ result = pl.subst_path(e, 'y', 'z')
+ assert result == ('bbb',), result
class PathListCacheTestCase(unittest.TestCase):