summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2004-05-25 13:24:06 (GMT)
committerSteven Knight <knight@baldmt.com>2004-05-25 13:24:06 (GMT)
commitf2a66d857de0eeb84ec0cd133d7a0cfd47e22175 (patch)
tree6ab5b45606148fa6cb488017757885cec2ec3256 /src
parent86e13b6f44ca46079fb23ede280ec3e682f2eb1d (diff)
downloadSCons-f2a66d857de0eeb84ec0cd133d7a0cfd47e22175.zip
SCons-f2a66d857de0eeb84ec0cd133d7a0cfd47e22175.tar.gz
SCons-f2a66d857de0eeb84ec0cd133d7a0cfd47e22175.tar.bz2
Add unit tests for the last two changes.
Diffstat (limited to 'src')
-rw-r--r--src/engine/SCons/Node/FSTests.py25
-rw-r--r--src/engine/SCons/Node/NodeTests.py9
-rw-r--r--src/engine/SCons/Sig/SigTests.py11
3 files changed, 45 insertions, 0 deletions
diff --git a/src/engine/SCons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py
index f69dd4e..f537acf 100644
--- a/src/engine/SCons/Node/FSTests.py
+++ b/src/engine/SCons/Node/FSTests.py
@@ -1389,6 +1389,30 @@ class StringDirTestCase(unittest.TestCase):
assert str(f) == os.path.join('sub', 'file')
assert not f.exists()
+class stored_infoTestCase(unittest.TestCase):
+ def runTest(self):
+ """Test how storing build information"""
+ test = TestCmd(workdir = '')
+ test.subdir('sub')
+ fs = SCons.Node.FS.FS(test.workpath(''))
+
+ d = fs.Dir('sub')
+ f = fs.File('file1', d)
+ bi = f.get_stored_info()
+ assert bi.bsig == None, bi.bsig
+
+ class MySConsign:
+ class Null:
+ def __init__(self):
+ self.xyzzy = 7
+ def get_entry(self, name):
+ return self.Null()
+
+ f = fs.File('file2', d)
+ f.dir.sconsign = MySConsign
+ bi = f.get_stored_info()
+ assert bi.xyzzy == 7, bi
+
class has_src_builderTestCase(unittest.TestCase):
def runTest(self):
"""Test the has_src_builder() method"""
@@ -1954,6 +1978,7 @@ if __name__ == "__main__":
suite.addTest(RepositoryTestCase())
suite.addTest(find_fileTestCase())
suite.addTest(StringDirTestCase())
+ suite.addTest(stored_infoTestCase())
suite.addTest(has_src_builderTestCase())
suite.addTest(prepareTestCase())
suite.addTest(get_actionsTestCase())
diff --git a/src/engine/SCons/Node/NodeTests.py b/src/engine/SCons/Node/NodeTests.py
index e36d6ce..f14339e 100644
--- a/src/engine/SCons/Node/NodeTests.py
+++ b/src/engine/SCons/Node/NodeTests.py
@@ -414,6 +414,15 @@ class NodeTestCase(unittest.TestCase):
result = node.explain()
assert result == None, result
+ class Null_BInfo:
+ def __init__(self):
+ pass
+
+ node.get_stored_info = Null_BInfo
+ node.__str__ = lambda: 'null_binfo'
+ result = node.explain()
+ assert result == "Cannot explain why `null_binfo' is being rebuilt: No previous build information found\n", result
+
# XXX additional tests for the guts of the functionality some day
def test_del_binfo(self):
diff --git a/src/engine/SCons/Sig/SigTests.py b/src/engine/SCons/Sig/SigTests.py
index 009addd..4390a60 100644
--- a/src/engine/SCons/Sig/SigTests.py
+++ b/src/engine/SCons/Sig/SigTests.py
@@ -194,6 +194,16 @@ def clear(nodes):
node.csig = None
node.bsig = None
+class SConsignEntryTestCase(unittest.TestCase):
+
+ def runTest(self):
+
+ se = SCons.Sig.SConsignEntry()
+ assert hasattr(se, 'timestamp'), "no timestamp attribute"
+ assert hasattr(se, 'bsig'), "no bsig attribute"
+ assert hasattr(se, 'csig'), "no csig attribute"
+ assert hasattr(se, 'implicit'), "no implicit attribute"
+
class SigTestBase:
def runTest(self):
@@ -397,6 +407,7 @@ class CalcTestCase(unittest.TestCase):
def suite():
suite = unittest.TestSuite()
+ suite.addTest(SConsignEntryTestCase())
suite.addTest(MD5TestCase())
suite.addTest(TimeStampTestCase())
suite.addTest(CalcTestCase())