diff options
author | Steven Knight <knight@baldmt.com> | 2004-12-16 14:22:29 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2004-12-16 14:22:29 (GMT) |
commit | 64c24fdd205f1d3fe584990aaf6ae050bb46c431 (patch) | |
tree | 56224b472ce45750199e13b89473109b50ea3f9a /src/engine/SCons/Scanner/ScannerTests.py | |
parent | 3869e426c19bd3b2e9bbb611b596220df9b34814 (diff) | |
download | SCons-64c24fdd205f1d3fe584990aaf6ae050bb46c431.zip SCons-64c24fdd205f1d3fe584990aaf6ae050bb46c431.tar.gz SCons-64c24fdd205f1d3fe584990aaf6ae050bb46c431.tar.bz2 |
Cache get_suffix() and get_build_env(). (Kevin Quick)
Diffstat (limited to 'src/engine/SCons/Scanner/ScannerTests.py')
-rw-r--r-- | src/engine/SCons/Scanner/ScannerTests.py | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src/engine/SCons/Scanner/ScannerTests.py b/src/engine/SCons/Scanner/ScannerTests.py index 6520788..00ad7fb 100644 --- a/src/engine/SCons/Scanner/ScannerTests.py +++ b/src/engine/SCons/Scanner/ScannerTests.py @@ -399,10 +399,18 @@ class ClassicTestCase(unittest.TestCase): env = DummyEnvironment() s = MyScanner("t", ['.suf'], 'MYPATH', '^my_inc (\S+)') + # This set of tests is intended to test the scanning operation + # of the Classic scanner. + + # Note that caching has been added for not just the includes + # but the entire scan call. The caching is based on the + # arguments, so we will fiddle with the path parameter to + # defeat this caching for the purposes of these tests. + # If the node doesn't exist, scanning turns up nothing. n1 = MyNode("n1") n1._exists = None - ret = s.scan(n1, env) + ret = s.function(n1, env) assert ret == [], ret # Verify that it finds includes from the contents. @@ -410,22 +418,27 @@ class ClassicTestCase(unittest.TestCase): n._exists = 1 n._dir = MyNode("n._dir") n._contents = 'my_inc abc\n' - ret = s.scan(n, env) + ret = s.function(n, env, ('foo',)) assert ret == ['abc'], ret # Verify that it uses the cached include info. n._contents = 'my_inc def\n' - ret = s.scan(n, env) + ret = s.function(n, env, ('foo2',)) assert ret == ['abc'], ret # Verify that if we wipe the cache, it uses the new contents. n.includes = None - ret = s.scan(n, env) + ret = s.function(n, env, ('foo3',)) assert ret == ['def'], ret + # Verify that overall scan results are cached even if individual + # results are de-cached + ret = s.function(n, env, ('foo2',)) + assert ret == ['abc'], ret + # Verify that it sorts what it finds. n.includes = ['xyz', 'uvw'] - ret = s.scan(n, env) + ret = s.function(n, env, ('foo4',)) assert ret == ['uvw', 'xyz'], ret # Verify that we use the rfile() node. @@ -434,9 +447,11 @@ class ClassicTestCase(unittest.TestCase): nr._dir = MyNode("nr._dir") nr.includes = ['jkl', 'mno'] n._rfile = nr - ret = s.scan(n, env) + ret = s.function(n, env, ('foo5',)) assert ret == ['jkl', 'mno'], ret + + class ClassicCPPTestCase(unittest.TestCase): def test_find_include(self): """Test the Scanner.ClassicCPP find_include() method""" |