summaryrefslogtreecommitdiffstats
path: root/test/option-c.py
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2003-04-30 15:35:30 (GMT)
committerSteven Knight <knight@baldmt.com>2003-04-30 15:35:30 (GMT)
commit212d77d88aa4374ef13f2e6bc7edf3395ac9736c (patch)
tree464ca9fd18866613629e2381dfb6b93190a5e2e6 /test/option-c.py
parent7ff542f3fb5b361087ef2738a82b5d849e005d45 (diff)
downloadSCons-212d77d88aa4374ef13f2e6bc7edf3395ac9736c.zip
SCons-212d77d88aa4374ef13f2e6bc7edf3395ac9736c.tar.gz
SCons-212d77d88aa4374ef13f2e6bc7edf3395ac9736c.tar.bz2
Provide uniform access to (some) command-line options. (Anthony Roach)
Diffstat (limited to 'test/option-c.py')
-rw-r--r--test/option-c.py54
1 files changed, 53 insertions, 1 deletions
diff --git a/test/option-c.py b/test/option-c.py
index d545b10..482525d 100644
--- a/test/option-c.py
+++ b/test/option-c.py
@@ -193,7 +193,7 @@ Removed foo3.out
Removed %s
Removed %s
Removed directory subd
-""" % (os.path.join('subd', 'SConscript'), os.path.join('subd','foon.in')))
+""" % (os.path.join('subd','SConscript'), os.path.join('subd', 'foon.in')))
test.run(arguments = '-c -n .', stdout=expect)
expect = test.wrap_stdout("""Removed foo1.out
@@ -207,4 +207,56 @@ test.run(arguments = '-c .', stdout=expect)
test.fail_test(os.path.exists(test.workpath('subdir', 'foon.in')))
test.fail_test(os.path.exists(test.workpath('subdir')))
+
+# Ensure that Set/GetOption('clean') works correctly:
+test.write('SConstruct', """
+B = Builder(action = r'%s build.py $TARGETS $SOURCES')
+env = Environment(BUILDERS = { 'B' : B })
+env.B(target = 'foo.out', source = 'foo.in')
+
+assert not GetOption('clean')
+"""%python)
+
+test.write('foo.in', '"Foo", I say!\n')
+
+test.run(arguments='foo.out')
+test.fail_test(test.read(test.workpath('foo.out')) != '"Foo", I say!\n')
+
+test.write('SConstruct', """
+B = Builder(action = r'%s build.py $TARGETS $SOURCES')
+env = Environment(BUILDERS = { 'B' : B })
+env.B(target = 'foo.out', source = 'foo.in')
+
+assert GetOption('clean')
+SetOption('clean', 0)
+assert GetOption('clean')
+"""%python)
+
+test.run(arguments='-c foo.out')
+test.fail_test(os.path.exists(test.workpath('foo.out')))
+
+test.write('SConstruct', """
+B = Builder(action = r'%s build.py $TARGETS $SOURCES')
+env = Environment(BUILDERS = { 'B' : B })
+env.B(target = 'foo.out', source = 'foo.in')
+"""%python)
+
+test.run(arguments='foo.out')
+test.fail_test(test.read(test.workpath('foo.out')) != '"Foo", I say!\n')
+
+test.write('SConstruct', """
+B = Builder(action = r'%s build.py $TARGETS $SOURCES')
+env = Environment(BUILDERS = { 'B' : B })
+env.B(target = 'foo.out', source = 'foo.in')
+
+assert not GetOption('clean')
+SetOption('clean', 1)
+assert GetOption('clean')
+"""%python)
+
+test.run(arguments='foo.out')
+test.fail_test(os.path.exists(test.workpath('foo.out')))
+
test.pass_test()
+
+