diff options
| author | Steven Knight <knight@baldmt.com> | 2003-04-10 05:35:38 (GMT) |
|---|---|---|
| committer | Steven Knight <knight@baldmt.com> | 2003-04-10 05:35:38 (GMT) |
| commit | 2f8be7360679ad5e0260f4965ea5dd9506c7b033 (patch) | |
| tree | 1379c046e82985011c5ab2d7604adf055e3140b9 /src/engine/SCons/EnvironmentTests.py | |
| parent | 81e5793a07783b29a13004f834b7579a0e1605bb (diff) | |
| download | SCons-2f8be7360679ad5e0260f4965ea5dd9506c7b033.zip SCons-2f8be7360679ad5e0260f4965ea5dd9506c7b033.tar.gz SCons-2f8be7360679ad5e0260f4965ea5dd9506c7b033.tar.bz2 | |
Implement Tool refactoring. (Chad Austin + Steve Leblanc)
Diffstat (limited to 'src/engine/SCons/EnvironmentTests.py')
| -rw-r--r-- | src/engine/SCons/EnvironmentTests.py | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py index 9a6eb1c..c041755 100644 --- a/src/engine/SCons/EnvironmentTests.py +++ b/src/engine/SCons/EnvironmentTests.py @@ -735,23 +735,34 @@ class EnvironmentTestCase(unittest.TestCase): def test_platform(self): """Test specifying a platform callable when instantiating.""" - def p(env): - env['XYZZY'] = 777 - env = Environment(platform = p) + class platform: + def __str__(self): return "TestPlatform" + def __call__(self, env): env['XYZZY'] = 777 + + def tool(env): + assert env['PLATFORM'] == "TestPlatform" + + env = Environment(platform = platform(), tools = [tool]) assert env['XYZZY'] == 777, env + assert env['PLATFORM'] == "TestPlatform" def test_tools(self): """Test specifying a tool callable when instantiating.""" - def t1(env, platform): + def t1(env): env['TOOL1'] = 111 - def t2(env, platform): + def t2(env): env['TOOL2'] = 222 - def t3(env, platform): + def t3(env): env['AAA'] = env['XYZ'] + def t4(env): + env['TOOL4'] = 444 env = Environment(tools = [t1, t2, t3], XYZ = 'aaa') assert env['TOOL1'] == 111, env['TOOL1'] assert env['TOOL2'] == 222, env - assert env['AAA'] == 'aaa', env + assert env['AAA'] == 'aaa', env + t4(env) + assert env['TOOL4'] == 444, env + def test_get(self): """Test the get() method.""" |
