summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/EnvironmentTests.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/SCons/EnvironmentTests.py')
-rw-r--r--src/engine/SCons/EnvironmentTests.py44
1 files changed, 43 insertions, 1 deletions
diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py
index 3066fc2..6859ee3 100644
--- a/src/engine/SCons/EnvironmentTests.py
+++ b/src/engine/SCons/EnvironmentTests.py
@@ -27,7 +27,7 @@ import sys
import unittest
from SCons.Environment import *
-
+import SCons.Warnings
built_it = {}
@@ -76,6 +76,7 @@ class EnvironmentTestCase(unittest.TestCase):
b1 = Builder(name = 'builder1')
b2 = Builder(name = 'builder2')
+ # BUILDERS as a list or instance, now deprecated...
built_it = {}
env1 = Environment(BUILDERS = b1)
env1.builder1.execute(target = 'out1')
@@ -100,6 +101,47 @@ class EnvironmentTestCase(unittest.TestCase):
assert env4.builder1.env is env4
assert env4.builder2.env is env4
+ # Now test BUILDERS as a dictionary.
+ built_it = {}
+ env5 = Environment(BUILDERS={ 'foo' : b1 })
+ env5['BUILDERS']['bar'] = b2
+ env5.foo.execute(target='out1')
+ env5.bar.execute(target='out2')
+ assert built_it['out1']
+ assert built_it['out2']
+
+ built_it = {}
+ env6 = Environment()
+ env6['BUILDERS'] = { 'foo' : b1,
+ 'bar' : b2 }
+ env6.foo.execute(target='out1')
+ env6.bar.execute(target='out2')
+ assert built_it['out1']
+ assert built_it['out2']
+
+ # Now test deprecated warning for BUILDERS as a list
+ # or instance.
+
+ SCons.Warnings.enableWarningClass(SCons.Warnings.DeprecatedWarning)
+ SCons.Warnings.warningAsException(1)
+ try:
+ try:
+ env=Environment(BUILDERS=b1)
+ except SCons.Warnings.DeprecatedWarning:
+ pass
+ else:
+ assert 0
+
+ try:
+ env=Environment(BUILDERS=[b1, b2])
+ except SCons.Warnings.DeprecatedWarning:
+ pass
+ else:
+ assert 0
+ finally:
+ SCons.Warnings.suppressWarningClass(SCons.Warnings.DeprecatedWarning)
+ SCons.Warnings.warningAsException(0)
+
def test_Scanners(self):
"""Test Scanner execution through different environments