summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/EnvironmentTests.py
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2005-01-04 13:23:05 (GMT)
committerSteven Knight <knight@baldmt.com>2005-01-04 13:23:05 (GMT)
commitd93f05865083c27a642cb2db5fe0729e550cccfe (patch)
treebb3d22ae7ad6c96ff18ec746a6d676807dfb05fc /src/engine/SCons/EnvironmentTests.py
parent916ed5005004b8beeaf07da497066853c7821755 (diff)
downloadSCons-d93f05865083c27a642cb2db5fe0729e550cccfe.zip
SCons-d93f05865083c27a642cb2db5fe0729e550cccfe.tar.gz
SCons-d93f05865083c27a642cb2db5fe0729e550cccfe.tar.bz2
Have ParseDepends() env.subst() the specified file name. Add an only_one keyword argument that will sanity check that the file only contains one dependency target.
Diffstat (limited to 'src/engine/SCons/EnvironmentTests.py')
-rw-r--r--src/engine/SCons/EnvironmentTests.py45
1 files changed, 41 insertions, 4 deletions
diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py
index 87e2e44..2e65ac1 100644
--- a/src/engine/SCons/EnvironmentTests.py
+++ b/src/engine/SCons/EnvironmentTests.py
@@ -1463,11 +1463,19 @@ def exists(env):
def test_ParseDepends(self):
"""Test the ParseDepends() method"""
- env = Environment()
-
test = TestCmd.TestCmd(workdir = '')
- test.write('mkdep', """
+ test.write('single', """
+#file: dependency
+
+f0: \
+ d1 \
+ d2 \
+ d3 \
+
+""")
+
+ test.write('multiple', """
f1: foo
f2 f3: bar
f4: abc def
@@ -1478,6 +1486,8 @@ f5: \
mno \
""")
+ env = Environment(SINGLE = test.workpath('single'))
+
tlist = []
dlist = []
def my_depends(target, dependency, tlist=tlist, dlist=dlist):
@@ -1486,13 +1496,40 @@ f5: \
env.Depends = my_depends
- env.ParseDepends(test.workpath('mkdep'))
+ env.ParseDepends(test.workpath('does_not_exist'))
+
+ exc_caught = None
+ try:
+ env.ParseDepends(test.workpath('does_not_exist'), must_exist=1)
+ except IOError:
+ exc_caught = 1
+ assert exc_caught, "did not catch expected IOError"
+ del tlist[:]
+ del dlist[:]
+
+ env.ParseDepends('$SINGLE', only_one=1)
+ t = map(str, tlist)
+ d = map(str, dlist)
+ assert t == ['f0'], t
+ assert d == ['d1', 'd2', 'd3'], d
+
+ del tlist[:]
+ del dlist[:]
+
+ env.ParseDepends(test.workpath('multiple'))
t = map(str, tlist)
d = map(str, dlist)
assert t == ['f1', 'f2', 'f3', 'f4', 'f5'], t
assert d == ['foo', 'bar', 'abc', 'def', 'ghi', 'jkl', 'mno'], d
+ exc_caught = None
+ try:
+ env.ParseDepends(test.workpath('multiple'), only_one=1)
+ except SCons.Errors.UserError:
+ exc_caught = 1
+ assert exc_caught, "did not catch expected UserError"
+
def test_Platform(self):
"""Test the Platform() method"""
env = Environment(WIN32='win32', NONE='no-such-platform')