diff options
| author | Steven Knight <knight@baldmt.com> | 2004-04-04 04:01:53 (GMT) |
|---|---|---|
| committer | Steven Knight <knight@baldmt.com> | 2004-04-04 04:01:53 (GMT) |
| commit | 30f01a9a0339978e15115cd2ad8fd169d88e1ab1 (patch) | |
| tree | 09d153a86945df53d71c32d53e865c6e2fd3c1b4 /src/engine/SCons/BuilderTests.py | |
| parent | e3395e16f968f033c77090aa8b4212c0f89ebf6a (diff) | |
| download | SCons-30f01a9a0339978e15115cd2ad8fd169d88e1ab1.zip SCons-30f01a9a0339978e15115cd2ad8fd169d88e1ab1.tar.gz SCons-30f01a9a0339978e15115cd2ad8fd169d88e1ab1.tar.bz2 | |
Allow a list of emitters to be called in sequence. (Chad Austin)
Diffstat (limited to 'src/engine/SCons/BuilderTests.py')
| -rw-r--r-- | src/engine/SCons/BuilderTests.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/engine/SCons/BuilderTests.py b/src/engine/SCons/BuilderTests.py index bd41f09..e2dd0e9 100644 --- a/src/engine/SCons/BuilderTests.py +++ b/src/engine/SCons/BuilderTests.py @@ -903,6 +903,42 @@ class BuilderTestCase(unittest.TestCase): tgt = builder4(env, source='ccc.4c') assert str(tgt) == 'emit4c-ccc', str(tgt) + # Test a list of emitter functions. + def emit5a(target, source, env): + source = map(str, source) + target = target + map(lambda x: 'emit5a-' + x[:-2], source) + return (target, source) + def emit5b(target, source, env): + source = map(str, source) + target = target + map(lambda x: 'emit5b-' + x[:-2], source) + return (target, source) + builder5 = SCons.Builder.Builder(action='foo', + emitter=[emit5a, emit5b], + node_factory=MyNode) + + tgts = builder5(env, target='target-5', source='aaa.5') + tgts = map(str, tgts) + assert tgts == ['target-5', 'emit5a-aaa', 'emit5b-aaa'], tgts + + # Test a list of emitter functions through the environment. + def emit6a(target, source, env): + source = map(str, source) + target = target + map(lambda x: 'emit6a-' + x[:-2], source) + return (target, source) + def emit6b(target, source, env): + source = map(str, source) + target = target + map(lambda x: 'emit6b-' + x[:-2], source) + return (target, source) + builder6 = SCons.Builder.Builder(action='foo', + emitter='$EMITTERLIST', + node_factory=MyNode) + + env = Environment(EMITTERLIST = [emit6a, emit6b]) + + tgts = builder6(env, target='target-6', source='aaa.6') + tgts = map(str, tgts) + assert tgts == ['target-6', 'emit6a-aaa', 'emit6b-aaa'], tgts + def test_no_target(self): """Test deducing the target from the source.""" |
