diff options
author | Luca Falavigna <dktrkranz@debian.org> | 2013-03-11 22:33:29 +0100 |
---|---|---|
committer | Luca Falavigna <dktrkranz@debian.org> | 2013-03-11 22:33:29 +0100 |
commit | e5a4f8c6dbf0dcfc74bfd8ba99099d9fe1064642 (patch) | |
tree | cf4f35e2a3b56525cf8c19a1b8fb3147d36f0229 /src/engine/SCons/PathListTests.py | |
parent | 2323daae4add07272c0f4feb9243c352a9ca4b18 (diff) | |
parent | cb3425abe0bc2d05caf401ca24b82a25a81f009d (diff) |
Merge tag 'upstream/2.3.0'
Upstream version 2.3.0
Diffstat (limited to 'src/engine/SCons/PathListTests.py')
-rw-r--r-- | src/engine/SCons/PathListTests.py | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/src/engine/SCons/PathListTests.py b/src/engine/SCons/PathListTests.py index bd12f3b..3d83995 100644 --- a/src/engine/SCons/PathListTests.py +++ b/src/engine/SCons/PathListTests.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -21,7 +21,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/PathListTests.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" +__revision__ = "src/engine/SCons/PathListTests.py 2013/03/03 09:48:35 garyo" import sys import unittest @@ -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): |