summaryrefslogtreecommitdiff
path: root/test/Clone-compatibility.py
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2006-11-04 05:31:24 +0000
committerSteven Knight <knight@baldmt.com>2006-11-04 05:31:24 +0000
commit1762fa36021c69466c66f9297caa7551c2fe11dc (patch)
tree6631963b4e4521d9a9a643edc1269409083e4651 /test/Clone-compatibility.py
parent6ba3fe1e1af2743602a4d0c55513deecc7e16df0 (diff)
downloadscons-1762fa36021c69466c66f9297caa7551c2fe11dc.tar.gz
Merged revisions 1667-1674 via svnmerge from
http://scons.tigris.org/svn/scons/branches/core ........ r1672 | stevenknight | 2006-11-03 23:11:52 -0600 (Fri, 03 Nov 2006) | 1 line 0.96.D480 - Don't use UNIX logic to detect an executable qmtest.py on Windows. ........ r1673 | stevenknight | 2006-11-03 23:18:59 -0600 (Fri, 03 Nov 2006) | 1 line 0.96.D481 - Remove the print statement from the previous checkin. ........ r1674 | stevenknight | 2006-11-03 23:25:43 -0600 (Fri, 03 Nov 2006) | 1 line 0.96.D482 - Create a env.Clone() method and encourage its use in favor of env.Copy(). ........
Diffstat (limited to 'test/Clone-compatibility.py')
-rw-r--r--test/Clone-compatibility.py57
1 files changed, 57 insertions, 0 deletions
diff --git a/test/Clone-compatibility.py b/test/Clone-compatibility.py
new file mode 100644
index 00000000..53719e93
--- /dev/null
+++ b/test/Clone-compatibility.py
@@ -0,0 +1,57 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Verify that a specific snippet of backwards-compatibility code works.
+
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', """
+
+# When the 0.96.93 release introduced the env.Clone() we advertised this
+# code as the correct pattern for maintaining the backwards compatibility
+# of SConstruct files to earlier release of SCons. Going forward, make
+# sure it still works (or at least doesn't blow up).
+import SCons.Environment
+try:
+ SCons.Environment.Environment.Clone
+except AttributeError:
+ SCons.Environment.Environment.Clone = SCons.Environment.Environment.Copy
+
+env1 = Environment(X = 1)
+env2 = env1.Clone(X = 2)
+
+print env1['X']
+print env2['X']
+""")
+
+test.run(arguments = '-q -Q', stdout = "1\n2\n")
+
+test.pass_test()