diff options
author | William Deegan <bill@baddogconsulting.com> | 2022-08-14 17:01:46 -0700 |
---|---|---|
committer | William Deegan <bill@baddogconsulting.com> | 2022-08-14 17:01:46 -0700 |
commit | f14796556e3b26c63422f62b2848b4be70088cb6 (patch) | |
tree | 74ee114538dfb074c20f1196e0cc8dc20699b64f | |
parent | 0d7d394d98ec72dc34496bce0d7824806a79f35d (diff) | |
download | scons-git-f14796556e3b26c63422f62b2848b4be70088cb6.tar.gz |
address comments by mwichmann
-rw-r--r-- | SCons/Script/Main.xml | 4 | ||||
-rw-r--r-- | test/ValidateOptions.py | 17 | ||||
-rw-r--r-- | test/fixture/SConstruct-check-valid-options | 2 |
3 files changed, 13 insertions, 10 deletions
diff --git a/SCons/Script/Main.xml b/SCons/Script/Main.xml index 746c1dcde..70b9d18eb 100644 --- a/SCons/Script/Main.xml +++ b/SCons/Script/Main.xml @@ -950,13 +950,13 @@ SetOption('max_drift', 0) <scons_function name="ValidateOptions"> <summary> <para> - Check that all the options provided by the user on the command line are either defined by SCons itself + Check that all the options specified on the command line are either defined by SCons itself or defined by &f-link-AddOption;. </para> <para> If there are any command line options not defined. - Calling this function will cause SCons to issue an error message and then exit with and error exit + Calling this function will cause SCons to issue an error message and then exit with an error exit status. </para> <para> diff --git a/test/ValidateOptions.py b/test/ValidateOptions.py index 09609efe2..65e216b9f 100644 --- a/test/ValidateOptions.py +++ b/test/ValidateOptions.py @@ -30,19 +30,22 @@ import TestSCons test = TestSCons.TestSCons() test.file_fixture('fixture/SConstruct-check-valid-options', 'SConstruct') -# Should see "This is in SConstruct" +# Should see "This is in SConstruct" because all options specified (none) are valid and +# so ValidatedOptions() won't exit before it's printed. test.run() test.must_contain_single_instance_of(test.stdout(), ["This is in SConstruct"]) +# Should see "This is in SConstruct" because all options specified (--testing=abc) are valid and +# so ValidatedOptions() won't exit before it's printed. test.run(arguments="--testing=abc") test.must_contain_single_instance_of(test.stdout(), ["This is in SConstruct"]) -# Should not see "This is in SConstruct" -test.run(arguments="--garbage=xyz", status=2, stderr=".*SCons Error: no such option: --garbage.*", match=TestSCons.match_re_dotall) -test.fail_test(("This is in SConstruct" in test.stdout()), message='"This is in SConstruct" should not be output. This means ValidateOptions() did not error out before this was printed') - - - +# Should not see "This is in SConstruct" because the option specified (--garbage=xyz) is invalid and +# so ValidatedOptions() will exit before it's printed. +test.run(arguments="--garbage=xyz", status=2, stderr=".*SCons Error: no such option: --garbage.*", + match=TestSCons.match_re_dotall) +test.fail_test(("This is in SConstruct" in test.stdout()), + message='"This is in SConstruct" should not be output. This means ValidateOptions() did not error out before this was printed') # Local Variables: # tab-width:4 diff --git a/test/fixture/SConstruct-check-valid-options b/test/fixture/SConstruct-check-valid-options index 0e2930dd4..47f253ccd 100644 --- a/test/fixture/SConstruct-check-valid-options +++ b/test/fixture/SConstruct-check-valid-options @@ -6,4 +6,4 @@ AddOption( ValidateOptions() -print("This is in SConstruct")
\ No newline at end of file +print("This is in SConstruct") |