diff options
author | Steven Knight <knight@baldmt.com> | 2004-04-10 07:35:32 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2004-04-10 07:35:32 (GMT) |
commit | 622d5777ae1e7db95933e3218a0619a764f20bd6 (patch) | |
tree | 27c321637161e64f419cc0b259c25205c2948417 /src/engine/SCons/Scanner/ScannerTests.py | |
parent | f8c2e8cf9666d85adbd85d0bc0dbebaca76fde08 (diff) | |
download | SCons-622d5777ae1e7db95933e3218a0619a764f20bd6.zip SCons-622d5777ae1e7db95933e3218a0619a764f20bd6.tar.gz SCons-622d5777ae1e7db95933e3218a0619a764f20bd6.tar.bz2 |
Add support for extending the suffixes a scanner knows about.
Diffstat (limited to 'src/engine/SCons/Scanner/ScannerTests.py')
-rw-r--r-- | src/engine/SCons/Scanner/ScannerTests.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/engine/SCons/Scanner/ScannerTests.py b/src/engine/SCons/Scanner/ScannerTests.py index 1051580..91a0f8c 100644 --- a/src/engine/SCons/Scanner/ScannerTests.py +++ b/src/engine/SCons/Scanner/ScannerTests.py @@ -34,7 +34,13 @@ class DummyEnvironment(UserDict.UserDict): UserDict.UserDict.__init__(self, dict) self.data.update(kw) def subst(self, strSubst): + if strSubst[0] == '$': + return self.data[strSubst[1:]] return strSubst + def subst_list(self, strSubst): + if strSubst[0] == '$': + return [self.data[strSubst[1:]]] + return [[strSubst]] def subst_path(self, path): if type(path) != type([]): path = [path] @@ -165,6 +171,24 @@ class ScannerTestCase(unittest.TestCase): self.failUnless(s.recursive == 1, "did not set recursive flag to 1") + def test_get_skeys(self): + """Test the Scanner.Base get_skeys() method""" + s = SCons.Scanner.Base(function = self.func) + sk = s.get_skeys() + self.failUnless(sk == [], + "did not initialize to expected []") + + s = SCons.Scanner.Base(function = self.func, skeys = ['.1', '.2']) + sk = s.get_skeys() + self.failUnless(sk == ['.1', '.2'], + "sk was %s, not ['.1', '.2']") + + s = SCons.Scanner.Base(function = self.func, skeys = '$LIST') + env = DummyEnvironment(LIST = ['.3', '.4']) + sk = s.get_skeys(env) + self.failUnless(sk == ['.3', '.4'], + "sk was %s, not ['.3', '.4']") + class CurrentTestCase(unittest.TestCase): def test_class(self): """Test the Scanner.Current class""" |