summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2019-09-12 19:35:46 (GMT)
committerWilliam Deegan <bill@baddogconsulting.com>2019-09-12 19:35:46 (GMT)
commit085d1c5b04a8fc2884c46f52b6299d10577627be (patch)
treeb970389948e3e4f5b943ecb35e2553510e1c55c1
parent5918e7bcd672d36f24b974005f6954da3bd997da (diff)
downloadSCons-085d1c5b04a8fc2884c46f52b6299d10577627be.zip
SCons-085d1c5b04a8fc2884c46f52b6299d10577627be.tar.gz
SCons-085d1c5b04a8fc2884c46f52b6299d10577627be.tar.bz2
incremental work on substs unit tests, approx 1/2 passing
-rw-r--r--src/engine/SCons/EnvironmentValue.py2
-rw-r--r--src/engine/SCons/EnvironmentValues.py4
-rw-r--r--src/engine/SCons/EnvironmentValuesSubstTests.py13
3 files changed, 11 insertions, 8 deletions
diff --git a/src/engine/SCons/EnvironmentValue.py b/src/engine/SCons/EnvironmentValue.py
index 5f6d502..7626e55 100644
--- a/src/engine/SCons/EnvironmentValue.py
+++ b/src/engine/SCons/EnvironmentValue.py
@@ -7,7 +7,7 @@ from SCons.Util import is_String, is_Sequence, CLVar
from SCons.Subst import AllowableExceptions, raise_exception
-_debug = True
+_debug = False
if _debug:
def debug(fmt, *args):
# format when needed
diff --git a/src/engine/SCons/EnvironmentValues.py b/src/engine/SCons/EnvironmentValues.py
index e8fe146..dec9c3b 100644
--- a/src/engine/SCons/EnvironmentValues.py
+++ b/src/engine/SCons/EnvironmentValues.py
@@ -22,7 +22,7 @@ AllowableExceptions = (KeyError,)
# space characters in the string result from the scons_subst() function.
space_sep = re.compile(r'[\t ]+(?![^{]*})')
-_debug = True
+_debug = False
if _debug:
def debug(fmt, *args):
# format when needed
@@ -398,7 +398,7 @@ class EnvironmentValues(object):
# v ends up being an instance of the callable class. Both of which can return another callable
# or a string which requires further processing, or a plain string, or blank.
if pv.value in self.values:
- to_call = self.values[pv.value].v
+ to_call = self.values[pv.value].value
elif pv.value in lvars:
to_call = pv.lvars[pv.value]
else:
diff --git a/src/engine/SCons/EnvironmentValuesSubstTests.py b/src/engine/SCons/EnvironmentValuesSubstTests.py
index 5c6a1b9..8dfbf27 100644
--- a/src/engine/SCons/EnvironmentValuesSubstTests.py
+++ b/src/engine/SCons/EnvironmentValuesSubstTests.py
@@ -514,7 +514,10 @@ class EnvVariablesSubstTestCase(SubstTestCase):
gvars = env.Dictionary()
failed = 0
+ test_number = 0
+ total_tests = len(subst_cases)/4
while subst_cases:
+ test_number += 1
input, eraw, ecmd, esig = subst_cases[:4]
result = EnvironmentValues.subst(input, env, mode=SUBST_RAW, gvars=gvars)
if result != eraw:
@@ -532,7 +535,7 @@ class EnvVariablesSubstTestCase(SubstTestCase):
print(" input %s => SIG %s did not match %s" % (repr(input), repr(result), repr(esig)))
failed = failed + 1
del subst_cases[:4]
- assert failed == 0, "%d subst() mode cases failed" % failed
+ assert failed == 0, "%d of %d subst() mode cases failed" % (failed, total_tests*3)
def test_subst_target_source(self):
"""Test EnvironmentValues.subst(): target= and source= arguments"""
@@ -1031,9 +1034,9 @@ class EnvVarsSubstListTestCase(SubstTestCase):
# ["|", "a", "|", "b", "|", "c", "1"],
# ["|", "|", "c", "1"],
- test = '$RECURSE'
- r = EnvironmentValues.subst_list(test, env, mode=SUBST_RAW, gvars=gvars)
- answer = [["foo", "bar"]]
+ test = '${LIST}'
+ r = EnvironmentValues.subst_list(test, env, mode=SUBST_SIG, gvars=gvars)
+ answer = [['This', 'is', 'test']]
assert r == answer, 'This should be %s not :%s' % (answer, r)
failed = 0
@@ -1059,7 +1062,7 @@ class EnvVarsSubstListTestCase(SubstTestCase):
print(" input %s => SIG %s did not match %s" % (repr(test_input), repr(result), repr(expected_sig)))
failed = failed + 1
del subst_list_cases[:4]
- assert failed == 0, "[%4d] %d subst() mode cases failed" % (test_number, failed)
+ assert failed == 0, "[%4d] %d subst() mode cases failed [%d passed]" % (test_number, failed, (test_number*3)-failed)
def test_subst_attribute_errors(self):
"""Test EnvironmentValues.subst_list(): handling attribute errors"""