diff options
Diffstat (limited to 'test/Default.py')
-rw-r--r-- | test/Default.py | 67 |
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() |