diff options
author | William Deegan <bill@baddogconsulting.com> | 2024-12-22 01:24:50 (GMT) |
---|---|---|
committer | William Deegan <bill@baddogconsulting.com> | 2024-12-22 01:24:50 (GMT) |
commit | 72121afb485b361bea5c2d43a0ad8c11a2e90e28 (patch) | |
tree | 8f8239db93ac1f93938bed2c59ca3a5d5c0f2ded /test | |
parent | f44f0c391ad852c0a447aade66d3ad68b23896b9 (diff) | |
download | SCons-72121afb485b361bea5c2d43a0ad8c11a2e90e28.zip SCons-72121afb485b361bea5c2d43a0ad8c11a2e90e28.tar.gz SCons-72121afb485b361bea5c2d43a0ad8c11a2e90e28.tar.bz2 |
Fixed mis-match between code and manpage for Help()'s local_only argument. Now code matches the documentation. Additionally fixturized the Help test
Diffstat (limited to 'test')
-rw-r--r-- | test/Help.py | 67 | ||||
-rw-r--r-- | test/fixture/SConstruct_HELP_AddOption.py | 22 |
2 files changed, 30 insertions, 59 deletions
diff --git a/test/Help.py b/test/Help.py index a090d42..329ac1d 100644 --- a/test/Help.py +++ b/test/Help.py @@ -81,51 +81,19 @@ Use scons -H for help about SCons built-in command-line options. test.run(arguments = '-h', stdout = expect) -# Bug #2831 - append flag to Help doesn't wipe out addoptions and variables used together -test.write('SConstruct', r""" +# Use fixturized SConstruct_HELP_AddOption.py for the remaining tests +# All of which add help with AddOption() and then call Help() various ways +# to test how the help from the option contributes to the Help()'s output -AddOption( - '--debugging', - dest='debugging', - action='store_true', - default=False, - metavar='BDEBUGGING', - help='Compile with debugging symbols', -) - -vars = Variables() -vars.Add(ListVariable('buildmod', 'List of modules to build', 'none', ['python'])) -DefaultEnvironment(tools=[]) -env = Environment() -Help(vars.GenerateHelpText(env), append=True) -""") +test.file_fixture('SConstruct_HELP_AddOption.py', 'SConstruct') +# Bug #2831 - append flag to Help doesn't wipe out addoptions and variables used together expect = ".*--debugging.*Compile with debugging symbols.*buildmod: List of modules to build.*" test.run(arguments = '-h', stdout = expect, match=TestSCons.match_re_dotall) # Bug 2831 # This test checks to verify that append=False doesn't include anything # but the expected help for the specified Variable() - -test.write('SConstruct', r""" -AddOption( - '--debugging', - dest='debugging', - action='store_true', - default=False, - metavar='BDEBUGGING', - help='Compile with debugging symbols', -) - -vars = Variables() -vars.Add(ListVariable('buildmod', 'List of modules to build', 'none', ['python'])) - -DefaultEnvironment(tools=[]) -env = Environment() - -Help(vars.GenerateHelpText(env), append=False) -""") - expect = """\ scons: Reading SConscript files ... scons: done reading SConscript files. @@ -139,29 +107,10 @@ buildmod: List of modules to build Use scons -H for help about SCons built-in command-line options. """ -test.run(arguments='-h', stdout=expect) +test.run(arguments='-h NO_APPEND=1', stdout=expect) -# Enhancement: keep_local flag saves the AddOption help, +# Enhancement: local_only flag saves the AddOption help, # but not SCons' own help. -test.write('SConstruct', r""" -AddOption( - '--debugging', - dest='debugging', - action='store_true', - default=False, - metavar='BDEBUGGING', - help='Compile with debugging symbols', -) - -vars = Variables() -vars.Add(ListVariable('buildmod', 'List of modules to build', 'none', ['python'])) - -DefaultEnvironment(tools=[]) -env = Environment() - -Help(vars.GenerateHelpText(env), append=True, keep_local=True) -""") - expect = """\ scons: Reading SConscript files ... scons: done reading SConscript files. @@ -177,7 +126,7 @@ buildmod: List of modules to build Use scons -H for help about SCons built-in command-line options. """ -test.run(arguments='-h', stdout=expect) +test.run(arguments='-h LOCAL_ONLY=1', stdout=expect) test.pass_test() diff --git a/test/fixture/SConstruct_HELP_AddOption.py b/test/fixture/SConstruct_HELP_AddOption.py index e69de29..f4ac237 100644 --- a/test/fixture/SConstruct_HELP_AddOption.py +++ b/test/fixture/SConstruct_HELP_AddOption.py @@ -0,0 +1,22 @@ + +AddOption( + '--debugging', + dest='debugging', + action='store_true', + default=False, + metavar='BDEBUGGING', + help='Compile with debugging symbols', +) + +vars = Variables() +vars.Add(ListVariable('buildmod', 'List of modules to build', 'none', ['python'])) +DefaultEnvironment(tools=[]) +env = Environment() + +if ARGUMENTS.get('NO_APPEND',False): + Help(vars.GenerateHelpText(env), append=False) +elif ARGUMENTS.get('LOCAL_ONLY',False): + Help(vars.GenerateHelpText(env), append=True, local_only=True) +else: + Help(vars.GenerateHelpText(env), append=True) + |