summaryrefslogtreecommitdiff
path: root/test/ARGLIST.py
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2004-05-23 12:11:42 +0000
committerSteven Knight <knight@baldmt.com>2004-05-23 12:11:42 +0000
commitd157a17661410b67ad01cefa8d60b4c265185738 (patch)
tree9c3de3248b5a9de87ec2e166227213fc768ac202 /test/ARGLIST.py
parent6f16c7447f7aa3be24662edf48fbf4466448cd9c (diff)
downloadscons-d157a17661410b67ad01cefa8d60b4c265185738.tar.gz
Add support for fetching command-line arguments by position number. (Gary Oberbrunner)
Diffstat (limited to 'test/ARGLIST.py')
-rw-r--r--test/ARGLIST.py48
1 files changed, 48 insertions, 0 deletions
diff --git a/test/ARGLIST.py b/test/ARGLIST.py
new file mode 100644
index 00000000..c70ed8ea
--- /dev/null
+++ b/test/ARGLIST.py
@@ -0,0 +1,48 @@
+#!/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__"
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', """
+i = 0
+for key, value in ARGLIST:
+ print "%d: %s = %s" % (i, key, value)
+ i = i + 1
+""")
+
+expect = test.wrap_stdout(read_str="""\
+0: a = 1
+1: bz = 3
+2: xx = sd
+3: zzz = foo=bar
+""",
+ build_str="scons: `.' is up to date.\n")
+
+test.run(arguments='a=1 bz=3 xx=sd zzz=foo=bar .', stdout = expect)
+
+test.pass_test()