diff options
author | Steven Knight <knight@baldmt.com> | 2002-10-13 12:52:05 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2002-10-13 12:52:05 (GMT) |
commit | 82bf497dd03f97f66f0026d9fea51b24af0af67b (patch) | |
tree | 0c054f13f3f8e0b743af71960602909eb9dc1c6a /test/Options.py | |
parent | 74a291228a3c4e833c49f6f842aa8ae0c0d36d75 (diff) | |
download | SCons-82bf497dd03f97f66f0026d9fea51b24af0af67b.zip SCons-82bf497dd03f97f66f0026d9fea51b24af0af67b.tar.gz SCons-82bf497dd03f97f66f0026d9fea51b24af0af67b.tar.bz2 |
Make undeclared options be ignored. (Anthony Roach)
Diffstat (limited to 'test/Options.py')
-rw-r--r-- | test/Options.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/Options.py b/test/Options.py index b431d88..2ecdd57 100644 --- a/test/Options.py +++ b/test/Options.py @@ -55,6 +55,9 @@ opts.Add('DEBUG_BUILD', opts.Add('CC', 'The C compiler') +opts.Add('UNSPECIFIED', + 'An option with no value') + def test_tool(env, platform): if env['RELEASE_BUILD']: env['CCFLAGS'] = env['CCFLAGS'] + ' -O' @@ -71,6 +74,19 @@ print env['DEBUG_BUILD'] print env['CC'] print env['CCFLAGS'] +# unspecified options should not be set: +assert not env.has_key('UNSPECIFIED') + +# undeclared options should be ignored: +assert not env.has_key('UNDECLARED') + +# calling Update() should not effect options that +# are not declared on the options object: +r = env['RELEASE_BUILD'] +opts = Options() +opts.Update(env) +assert env['RELEASE_BUILD'] == r + Default(env.Alias('dummy')) """) @@ -91,6 +107,12 @@ check(['1', '0', cc, ccflags + ' -O']) test.run(arguments='"CC=not_a_c_compiler"') check(['0', '1', 'not_a_c_compiler', ccflags + ' -g']) +test.run(arguments='"UNDECLARED=foo"') +check(['0', '1', cc, ccflags + ' -g']) + +test.run(arguments='"CCFLAGS=--taco"') +check(['0', '1', cc, ccflags + ' -g']) + test.write('custom.py', """ DEBUG_BUILD=0 RELEASE_BUILD=1 @@ -119,6 +141,10 @@ CC: The C compiler default: None actual: %s +UNSPECIFIED: An option with no value + default: None + actual: None + Use scons -H for help about command-line options. """%cc) |