summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/UtilTests.py
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2003-05-10 18:26:20 (GMT)
committerSteven Knight <knight@baldmt.com>2003-05-10 18:26:20 (GMT)
commit088746100c58e3bf3dd20a00d8328e635e6c0b24 (patch)
treeca589ce39f942d53b40e87cfec89a1e123194217 /src/engine/SCons/UtilTests.py
parent2333feeb8864c753a8834a45f0743876e28386e7 (diff)
downloadSCons-088746100c58e3bf3dd20a00d8328e635e6c0b24.zip
SCons-088746100c58e3bf3dd20a00d8328e635e6c0b24.tar.gz
SCons-088746100c58e3bf3dd20a00d8328e635e6c0b24.tar.bz2
Interpolate the null string for illegal list subscripts.
Diffstat (limited to 'src/engine/SCons/UtilTests.py')
-rw-r--r--src/engine/SCons/UtilTests.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/engine/SCons/UtilTests.py b/src/engine/SCons/UtilTests.py
index a48b302..84655a9 100644
--- a/src/engine/SCons/UtilTests.py
+++ b/src/engine/SCons/UtilTests.py
@@ -227,6 +227,20 @@ class UtilTestCase(unittest.TestCase):
newcom = scons_subst("$FOO $BAZ $BAR", DummyEnv(glob))
assert newcom == "BAR $FOO BAR", newcom
+ # Test that we don't blow up even if they subscript something
+ # in ways they "can't."
+ glob = { "FOO" : "BAR",
+ "NOTHING" : "" ,
+ "NONE" : None }
+ newcom = scons_subst("${FOO[0]}", DummyEnv(glob))
+ assert newcom == "B", newcom
+ newcom = scons_subst("${FOO[7]}", DummyEnv(glob))
+ assert newcom == "", newcom
+ newcom = scons_subst("${NOTHING[1]}", DummyEnv(glob))
+ assert newcom == "", newcom
+ newcom = scons_subst("${NONE[2]}", DummyEnv(glob))
+ assert newcom == "", newcom
+
def test_splitext(self):
assert splitext('foo') == ('foo','')
assert splitext('foo.bar') == ('foo','.bar')