summaryrefslogtreecommitdiff
path: root/src/engine/SCons/Scanner/ProgTests.py
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2015-06-21 07:55:31 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2015-06-21 07:55:31 +0200
commit39fa0bace059116d9a45e09fcd18691390b166bd (patch)
tree77f5abf2964bd92dc9e338654a4ffaaffc24d9ce /src/engine/SCons/Scanner/ProgTests.py
parentf9b0c331d8b9d03be91b56e324f59424af45302b (diff)
parentf7e5d2b46b03cc4bc09c38f7e0873378bb9c3b78 (diff)
Merge tag 'upstream/2.3.5'
Upstream version 2.3.5
Diffstat (limited to 'src/engine/SCons/Scanner/ProgTests.py')
-rw-r--r--src/engine/SCons/Scanner/ProgTests.py39
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: