diff options
author | Steven Knight <knight@baldmt.com> | 2004-03-03 14:45:54 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2004-03-03 14:45:54 (GMT) |
commit | c6a5a383c8771988bc829ef90111afc4db03cc5f (patch) | |
tree | f9f67f13e16ad2362292ac0c93a48ebdce7f7ab7 /src/engine/SCons/Scanner/ScannerTests.py | |
parent | 5174a3776049049f08a4812da16dfe03ede94a9e (diff) | |
download | SCons-c6a5a383c8771988bc829ef90111afc4db03cc5f.zip SCons-c6a5a383c8771988bc829ef90111afc4db03cc5f.tar.gz SCons-c6a5a383c8771988bc829ef90111afc4db03cc5f.tar.bz2 |
Refactor Scanner internals as a prelude to fixing use of '${TARGET.dir}'
in *PATH variables.
Diffstat (limited to 'src/engine/SCons/Scanner/ScannerTests.py')
-rw-r--r-- | src/engine/SCons/Scanner/ScannerTests.py | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/engine/SCons/Scanner/ScannerTests.py b/src/engine/SCons/Scanner/ScannerTests.py index 8c8744d..3d72bd2 100644 --- a/src/engine/SCons/Scanner/ScannerTests.py +++ b/src/engine/SCons/Scanner/ScannerTests.py @@ -23,12 +23,32 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" +import sys import unittest +import UserDict + import SCons.Scanner -import sys -class DummyEnvironment: - pass +class DummyEnvironment(UserDict.UserDict): + def __init__(self, dict=None, **kw): + UserDict.UserDict.__init__(self, dict) + self.data.update(kw) + def subst(self, strSubst): + return strSubst + +class FindPathDirsTestCase(unittest.TestCase): + def test_FindPathDirs(self): + """Test the FindPathDirs callable class""" + + class FS: + def Rsearchall(self, nodes, must_exist=0, clazz=None, cwd=dir): + return ['xxx'] + nodes + + env = DummyEnvironment(LIBPATH = [ 'foo' ]) + + fpd = SCons.Scanner.FindPathDirs('LIBPATH', FS()) + result = fpd(env, dir) + assert result == ('xxx', 'foo'), result class ScannerTestCase(unittest.TestCase): @@ -297,6 +317,7 @@ class ClassicCPPTestCase(unittest.TestCase): def suite(): suite = unittest.TestSuite() tclasses = [ + FindPathDirsTestCase, ScannerTestCase, CurrentTestCase, ClassicTestCase, |