summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2003-12-23 15:08:10 (GMT)
committerSteven Knight <knight@baldmt.com>2003-12-23 15:08:10 (GMT)
commit15a13d961b7cef6c08fa0ccf18428339487600a8 (patch)
treefca4397998b84072ad11ae732c629ea741cf2d41 /src
parent4c89d3cf50ccc16d32a5cd2c32fe4878e079d4e5 (diff)
downloadSCons-15a13d961b7cef6c08fa0ccf18428339487600a8.zip
SCons-15a13d961b7cef6c08fa0ccf18428339487600a8.tar.gz
SCons-15a13d961b7cef6c08fa0ccf18428339487600a8.tar.bz2
Minor test enhancements.
Diffstat (limited to 'src')
-rw-r--r--src/engine/SCons/EnvironmentTests.py50
1 files changed, 29 insertions, 21 deletions
diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py
index 5fee3dd..c9270f7 100644
--- a/src/engine/SCons/EnvironmentTests.py
+++ b/src/engine/SCons/EnvironmentTests.py
@@ -261,23 +261,23 @@ class EnvironmentTestCase(unittest.TestCase):
assert nodes[1].c == 1, nodes[1]
def test_subst(self):
- """Test substituting construction variables within strings
-
- Check various combinations, including recursive expansion
- of variables into other variables.
- """
- env = Environment(AAA = 'a', BBB = 'b')
- mystr = env.subst("$AAA ${AAA}A $BBBB $BBB")
- assert mystr == "a aA b", str
+ """Test substituting construction variables within strings
+
+ Check various combinations, including recursive expansion
+ of variables into other variables.
+ """
+ env = Environment(AAA = 'a', BBB = 'b')
+ mystr = env.subst("$AAA ${AAA}A $BBBB $BBB")
+ assert mystr == "a aA b", mystr
# Changed the tests below to reflect a bug fix in
# subst()
env = Environment(AAA = '$BBB', BBB = 'b', BBBA = 'foo')
- mystr = env.subst("$AAA ${AAA}A ${AAA}B $BBB")
- assert mystr == "b bA bB b", str
- env = Environment(AAA = '$BBB', BBB = '$CCC', CCC = 'c')
- mystr = env.subst("$AAA ${AAA}A ${AAA}B $BBB")
- assert mystr == "c cA cB c", str
+ mystr = env.subst("$AAA ${AAA}A ${AAA}B $BBB")
+ assert mystr == "b bA bB b", mystr
+ env = Environment(AAA = '$BBB', BBB = '$CCC', CCC = 'c')
+ mystr = env.subst("$AAA ${AAA}A ${AAA}B $BBB")
+ assert mystr == "c cA cB c", mystr
env = Environment(AAA = '$BBB', BBB = '$CCC', CCC = [ 'a', 'b\nc' ])
lst = env.subst_list([ "$AAA", "B $CCC" ])
@@ -571,9 +571,12 @@ class EnvironmentTestCase(unittest.TestCase):
env = Environment(CPPPATH = '', F77PATH = '', LIBPATH = '',
RDirs=RDirs)
- assert len(env.subst_list('$_CPPINCFLAGS')[0]) == 0
- assert len(env.subst_list('$_F77INCFLAGS')[0]) == 0
- assert len(env.subst_list('$_LIBDIRFLAGS')[0]) == 0
+ l = env.subst_list('$_CPPINCFLAGS')
+ assert len(l[0]) == 0, l[0]
+ l = env.subst_list('$_F77INCFLAGS')
+ assert len(l[0]) == 0, l[0]
+ l = env.subst_list('$_LIBDIRFLAGS')
+ assert len(l[0]) == 0, l[0]
SCons.Node.FS.default_fs.Repository('/rep1')
SCons.Node.FS.default_fs.Repository('/rep2')
@@ -706,11 +709,16 @@ class EnvironmentTestCase(unittest.TestCase):
"Test _concat()"
e1 = Environment(PRE='pre', SUF='suf', STR='a b', LIST=['a', 'b'])
s = e1.subst
- assert s("${_concat('', '', '', __env__)}") == ''
- assert s("${_concat('', [], '', __env__)}") == ''
- assert s("${_concat(PRE, '', SUF, __env__)}") == ''
- assert s("${_concat(PRE, STR, SUF, __env__)}") == 'prea bsuf'
- assert s("${_concat(PRE, LIST, SUF, __env__)}") == 'preasuf prebsuf'
+ x = s("${_concat('', '', '', __env__)}")
+ assert x == '', x
+ x = s("${_concat('', [], '', __env__)}")
+ assert x == '', x
+ x = s("${_concat(PRE, '', SUF, __env__)}")
+ assert x == '', x
+ x = s("${_concat(PRE, STR, SUF, __env__)}")
+ assert x == 'prea bsuf', x
+ x = s("${_concat(PRE, LIST, SUF, __env__)}")
+ assert x == 'preasuf prebsuf', x