summaryrefslogtreecommitdiffstats
path: root/test/Default.py
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2001-09-20 12:51:39 (GMT)
committerSteven Knight <knight@baldmt.com>2001-09-20 12:51:39 (GMT)
commite02616efd0158ecd07b6f6cdea564e7aa648ab99 (patch)
tree5fdbdd9e3f3b72b2d0002f743ae951bade5252f7 /test/Default.py
parent2e862e98a5109da56222d7ba7bcc52c5d718ea82 (diff)
downloadSCons-e02616efd0158ecd07b6f6cdea564e7aa648ab99.zip
SCons-e02616efd0158ecd07b6f6cdea564e7aa648ab99.tar.gz
SCons-e02616efd0158ecd07b6f6cdea564e7aa648ab99.tar.bz2
Add support for Default() targets.
Diffstat (limited to 'test/Default.py')
-rw-r--r--test/Default.py67
1 files changed, 67 insertions, 0 deletions
diff --git a/test/Default.py b/test/Default.py
new file mode 100644
index 0000000..0666a77
--- /dev/null
+++ b/test/Default.py
@@ -0,0 +1,67 @@
+#!/usr/bin/env python
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import os
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.subdir('one', 'two', 'three')
+
+test.write(['one', 'SConstruct'], """
+env = Environment()
+env.Program(target = 'foo', source = 'foo.c')
+env.Program(target = 'bar', source = 'bar.c')
+Default('foo')
+""")
+
+test.write(['two', 'SConstruct'], """
+env = Environment()
+env.Program(target = 'foo', source = 'foo.c')
+env.Program(target = 'bar', source = 'bar.c')
+Default('foo', 'bar')
+""")
+
+test.write(['three', 'SConstruct'], """
+env = Environment()
+env.Program(target = 'foo', source = 'foo.c')
+env.Program(target = 'bar', source = 'bar.c')
+Default('foo bar')
+""")
+
+for dir in ['one', 'two', 'three']:
+
+ foo_c = os.path.join(dir, 'foo.c')
+ bar_c = os.path.join(dir, 'bar.c')
+
+ test.write(foo_c, """
+int
+main(int argc, char *argv[])
+{
+ printf("%s\n");
+ exit (0);
+}
+""" % foo_c)
+
+ test.write(bar_c, """
+int
+main(int argc, char *argv[])
+{
+ printf("%s\n");
+ exit (0);
+}
+""" % bar_c)
+
+ test.run(chdir = dir) # no arguments, use the Default
+
+test.run(program = test.workpath('one', 'foo'), stdout = "one/foo.c\n")
+test.fail_test(os.path.exists(test.workpath('one', 'bar')))
+
+test.run(program = test.workpath('two', 'foo'), stdout = "two/foo.c\n")
+test.run(program = test.workpath('two', 'bar'), stdout = "two/bar.c\n")
+
+test.run(program = test.workpath('three', 'foo'), stdout = "three/foo.c\n")
+test.run(program = test.workpath('three', 'bar'), stdout = "three/bar.c\n")
+
+test.pass_test()