diff options
author | Greg Ward <greg@gerg.ca> | 2012-03-17 20:04:42 (GMT) |
---|---|---|
committer | Greg Ward <greg@gerg.ca> | 2012-03-17 20:04:42 (GMT) |
commit | a16ccac6e69f38d5a8531ec81c988e28aaf287bf (patch) | |
tree | 558bcd653a53240755e648ca0d23fb7f6d369231 /src/engine/SCons/Tool/javacTests.py | |
parent | a2bfc43f503a2ffb4b3afb6feab7f73e6be518aa (diff) | |
download | SCons-a16ccac6e69f38d5a8531ec81c988e28aaf287bf.zip SCons-a16ccac6e69f38d5a8531ec81c988e28aaf287bf.tar.gz SCons-a16ccac6e69f38d5a8531ec81c988e28aaf287bf.tar.bz2 |
Add more tests for SCons.Tool.javac.pathopt; fix exposed bugs.
(Specifically, having a default path without setting the corresponding
construction variable did not work.)
Diffstat (limited to 'src/engine/SCons/Tool/javacTests.py')
-rw-r--r-- | src/engine/SCons/Tool/javacTests.py | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/src/engine/SCons/Tool/javacTests.py b/src/engine/SCons/Tool/javacTests.py index 0335437..fc7f271 100644 --- a/src/engine/SCons/Tool/javacTests.py +++ b/src/engine/SCons/Tool/javacTests.py @@ -40,6 +40,13 @@ class pathoptTestCase(unittest.TestCase): actual = popt(None, None, env, None) self.assertEquals(expect, actual) + def assert_pathopt_default(self, expect, path, default): + popt = SCons.Tool.javac.pathopt('-foopath', 'FOOPATH', default='DPATH') + env = {'FOOPATH': path, + 'DPATH': default} + actual = popt(None, None, env, None) + self.assertEquals(expect, actual) + def test_unset(self): self.assert_pathopt([], None) self.assert_pathopt([], '') @@ -69,14 +76,27 @@ class pathoptTestCase(unittest.TestCase): self.assert_pathopt(['-foopath', '/foo:/bar'], ['/foo', DummyNode('/bar')]) - def test_default(self): - popt = SCons.Tool.javac.pathopt('-foopath', 'FOOPATH', default='DPATH') - env = {'FOOPATH': ['/foo', '/bar'], - 'DPATH': '/baz'} + def test_default_str(self): + self.assert_pathopt_default( + ['-foopath', '/foo:/bar:/baz'], + ['/foo', '/bar'], + '/baz') - expect = ['-foopath', os.pathsep.join(['/foo', '/bar', '/baz'])] - actual = popt(None, None, env, None) - self.assertEquals(expect, actual) + def test_default_list(self): + self.assert_pathopt_default( + ['-foopath', '/foo:/bar:/baz'], + ['/foo', '/bar'], + ['/baz']) + + def test_default_unset(self): + self.assert_pathopt_default( + ['-foopath', '/foo'], + '/foo', + None) + self.assert_pathopt_default( + ['-foopath', '/foo'], + '/foo', + '') if __name__ == "__main__": unittest.main() |