Source

SCons / src / engine / SCons / PathListTests.py

Diff from to

src/engine/SCons/PathListTests.py

                 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
 
         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):
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.