diff options
Diffstat (limited to 'src/engine/SCons/Scanner/ProgTests.py')
-rw-r--r-- | src/engine/SCons/Scanner/ProgTests.py | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/src/engine/SCons/Scanner/ProgTests.py b/src/engine/SCons/Scanner/ProgTests.py index 08fcaa7..1789ac2 100644 --- a/src/engine/SCons/Scanner/ProgTests.py +++ b/src/engine/SCons/Scanner/ProgTests.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2001 - 2014 The SCons Foundation +# Copyright (c) 2001 - 2015 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/Scanner/ProgTests.py 2014/09/27 12:51:43 garyo" +__revision__ = "src/engine/SCons/Scanner/ProgTests.py pchdll:3325:cd517fae59a4 2015/06/18 06:53:27 bdbaddog" import os.path import sys @@ -32,6 +32,7 @@ import TestUnit import SCons.Node.FS import SCons.Scanner.Prog +import SCons.Subst test = TestCmd.TestCmd(workdir = '') @@ -72,12 +73,7 @@ class DummyEnvironment(object): del self.Dictionary()[key] def subst(self, s, target=None, source=None, conv=None): - try: - if s[0] == '$': - return self._dict[s[1:]] - except IndexError: - return '' - return s + return SCons.Subst.scons_subst(s, self, gvars=self._dict, lvars=self._dict) def subst_path(self, path, target=None, source=None, conv=None): if not isinstance(path, list): @@ -223,6 +219,31 @@ class ProgramScannerTestCase8(unittest.TestCase): deps = s(DummyNode('dummy'), env, path) assert deps == [n1, n2], deps +class ProgramScannerTestCase9(unittest.TestCase): + def runTest(self): + env = DummyEnvironment(LIBPATH=[ test.workpath("dir") ], + LIBS=['foo', '$LIBBAR'], + LIBPREFIXES=['lib'], + LIBSUFFIXES=['.a'], + LIBBAR=['sub/libbar', 'xyz.other']) + s = SCons.Scanner.Prog.ProgramScanner() + path = s.path(env) + deps = s(DummyNode('dummy'), env, path) + assert deps_match(deps, ['dir/libfoo.a', 'dir/sub/libbar.a', 'dir/libxyz.other']), list(map(str, deps)) + +class ProgramScannerTestCase10(unittest.TestCase): + def runTest(self): + env = DummyEnvironment(LIBPATH=[ test.workpath("dir") ], + LIBS=['foo', '$LIBBAR'], + LIBPREFIXES=['lib'], + LIBSUFFIXES=['.a'], + LIBBAR='sub/libbar $LIBBAR2', + LIBBAR2=['xyz.other']) + s = SCons.Scanner.Prog.ProgramScanner() + path = s.path(env) + deps = s(DummyNode('dummy'), env, path) + assert deps_match(deps, ['dir/libfoo.a', 'dir/sub/libbar.a', 'dir/libxyz.other']), list(map(str, deps)) + def suite(): suite = unittest.TestSuite() suite.addTest(ProgramScannerTestCase1()) @@ -232,6 +253,8 @@ def suite(): suite.addTest(ProgramScannerTestCase6()) suite.addTest(ProgramScannerTestCase7()) suite.addTest(ProgramScannerTestCase8()) + suite.addTest(ProgramScannerTestCase9()) + suite.addTest(ProgramScannerTestCase10()) try: unicode except NameError: pass else: |