summaryrefslogtreecommitdiff
path: root/test/Command.py
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2001-09-21 01:30:38 +0000
committerSteven Knight <knight@baldmt.com>2001-09-21 01:30:38 +0000
commitc8bbea81460524f6469fa4b6afc2be5a6f338edc (patch)
treeaa6a337d270384c8e12577542615ae3f3f51dc39 /test/Command.py
parentb6251d39d5f5b187a7455923caeede3b962a6d0e (diff)
downloadscons-c8bbea81460524f6469fa4b6afc2be5a6f338edc.tar.gz
Add additional tests to provide more examples.
Diffstat (limited to 'test/Command.py')
-rw-r--r--test/Command.py44
1 files changed, 44 insertions, 0 deletions
diff --git a/test/Command.py b/test/Command.py
new file mode 100644
index 00000000..abe060e2
--- /dev/null
+++ b/test/Command.py
@@ -0,0 +1,44 @@
+
+#!/usr/bin/env python
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.pass_test() #XXX Short-circuit until this is implemented.
+
+test.write('build.py', r"""
+import sys
+contents = open(sys.argv[2], 'r').read() + open(sys.argv[3], 'r').read()
+file = open(sys.argv[1], 'w')
+file.write(contents)
+file.close()
+""")
+
+test.write('SConstruct', """
+env = Environment()
+env.Command(target = 'f1.out', source = 'f1.in',
+ action = "python build.py %(target)s %(source)s")
+env.Command(target = 'f2.out', source = 'f2.in',
+ action = "python build.py temp2 %(source)s\npython build.py %(target)s temp2")
+env.Command(target = 'f3.out', source = 'f3.in',
+ action = ["python build.py temp3 %(source)s",
+ "python build.py %(target)s temp3"])
+# Eventually, add ability to do execute Python code.
+""")
+
+test.write('f1.in', "f1.in\n")
+
+test.write('f2.in', "f2.in\n")
+
+test.write('f3.in', "f3.in\n")
+
+test.run(arguments = '.')
+
+test.fail_test(test.read('f1.out') != "f1.in\n")
+test.fail_test(test.read('f2.out') != "f2.in\n")
+test.fail_test(test.read('f3.out') != "f3.in\n")
+
+test.pass_test()