summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/BuilderTests.py
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2003-07-24 08:11:18 (GMT)
committerSteven Knight <knight@baldmt.com>2003-07-24 08:11:18 (GMT)
commit7a3d5b8e06e44fee43fc78d7eb72b8d271022c18 (patch)
tree9644777ce4b886806bd13ce207e047da336a7b12 /src/engine/SCons/BuilderTests.py
parent5d238601a22fa009de4df38e0257c405f9b243db (diff)
downloadSCons-7a3d5b8e06e44fee43fc78d7eb72b8d271022c18.zip
SCons-7a3d5b8e06e44fee43fc78d7eb72b8d271022c18.tar.gz
SCons-7a3d5b8e06e44fee43fc78d7eb72b8d271022c18.tar.bz2
Add a QT tool. (Christoph Wiedemann)
Diffstat (limited to 'src/engine/SCons/BuilderTests.py')
-rw-r--r--src/engine/SCons/BuilderTests.py29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/engine/SCons/BuilderTests.py b/src/engine/SCons/BuilderTests.py
index d486e70..e8a6199 100644
--- a/src/engine/SCons/BuilderTests.py
+++ b/src/engine/SCons/BuilderTests.py
@@ -73,6 +73,8 @@ class Environment:
try:
if s[0] == '$':
return self.d.get(s[1:], '')
+ if s[1] == '$':
+ return s[0] + self.d.get(s[2:], '')
except IndexError:
pass
return self.d.get(s, s)
@@ -444,8 +446,12 @@ class BuilderTestCase(unittest.TestCase):
def func_action(target, source, env):
return 0
+ env['BAR_SUFFIX'] = '.BAR2'
+ env['FOO_SUFFIX'] = '.FOO2'
builder = SCons.Builder.Builder(action={ '.foo' : func_action,
- '.bar' : func_action })
+ '.bar' : func_action,
+ '$BAR_SUFFIX' : func_action,
+ '$FOO_SUFFIX' : func_action })
assert isinstance(builder, SCons.Builder.CompositeBuilder)
assert isinstance(builder.action, SCons.Action.CommandGeneratorAction)
@@ -465,6 +471,27 @@ class BuilderTestCase(unittest.TestCase):
match = str(e) == "While building `['test3']' from `test1.foo': Cannot build multiple sources with different extensions: .bar, .foo"
assert match, e
+ tgt = builder(env, target='test4', source=['test4.BAR2'])
+ assert isinstance(tgt.builder, SCons.Builder.BuilderBase)
+ try:
+ tgt.build()
+ flag = 1
+ except SCons.Errors.UserError, e:
+ print e
+ flag = 0
+ assert flag, "It should be possible to define actions in composite builders using variables."
+ env['FOO_SUFFIX'] = '.BAR2'
+ builder.add_action('$NEW_SUFFIX', func_action)
+ flag = 0
+ tgt = builder(env, target='test5', source=['test5.BAR2'])
+ try:
+ tgt.build()
+ except SCons.Errors.UserError:
+ flag = 1
+ assert flag, "UserError should be thrown when we build targets with ambigous suffixes."
+ del env.d['FOO_SUFFIX']
+ del env.d['BAR_SUFFIX']
+
foo_bld = SCons.Builder.Builder(action = 'a-foo',
src_suffix = '.ina',
suffix = '.foo')