summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMats Wichmann <mats@linux.com>2024-09-16 14:39:05 (GMT)
committerMats Wichmann <mats@linux.com>2024-09-16 14:42:23 (GMT)
commit23ccbabb3e14eab68de76eb020fde62d0ac28087 (patch)
tree2e376789ac2612f12cb1360688abb648f57b02ae /test
parent5d453c2200bfd5085514916600f5780b1e7d5488 (diff)
downloadSCons-23ccbabb3e14eab68de76eb020fde62d0ac28087.zip
SCons-23ccbabb3e14eab68de76eb020fde62d0ac28087.tar.gz
SCons-23ccbabb3e14eab68de76eb020fde62d0ac28087.tar.bz2
Fix short-option processing
Override the _process_short_opts method from optparse so it behaves better. This fix is lifted directly from #3799, leaving an additional part to apply later. Fixes #3798 Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'test')
-rw-r--r--test/AddOption/basic.py3
-rw-r--r--test/SCONSFLAGS.py8
2 files changed, 6 insertions, 5 deletions
diff --git a/test/AddOption/basic.py b/test/AddOption/basic.py
index 83297a8..f488c70 100644
--- a/test/AddOption/basic.py
+++ b/test/AddOption/basic.py
@@ -38,7 +38,7 @@ from SCons.Script.SConsOptions import SConsOption
DefaultEnvironment(tools=[])
env = Environment(tools=[])
AddOption(
- '--force',
+ '-F', '--force',
action="store_true",
help='force installation (overwrite any existing files)',
)
@@ -74,6 +74,7 @@ if GetOption('zcount'):
test.run('-Q -q .', stdout="None\nNone\n")
test.run('-Q -q . --force', stdout="True\nNone\n")
+test.run('-Q -q . -F', stdout="True\nNone\n")
test.run('-Q -q . --prefix=/home/foo', stdout="None\n/home/foo\n")
test.run('-Q -q . -- --prefix=/home/foo --force', status=1, stdout="None\nNone\n")
# check that SetOption works on prefix...
diff --git a/test/SCONSFLAGS.py b/test/SCONSFLAGS.py
index 4a44f30..ffccf1f 100644
--- a/test/SCONSFLAGS.py
+++ b/test/SCONSFLAGS.py
@@ -62,15 +62,15 @@ test.run(arguments = "-H")
test.must_not_contain_any_line(test.stdout(), ['Help text.'])
test.must_contain_all_lines(test.stdout(), ['-H, --help-options'])
-os.environ['SCONSFLAGS'] = '-Z'
-
expect = r"""usage: scons [OPTIONS] [VARIABLES] [TARGETS]
SCons Error: no such option: -Z
"""
-test.run(arguments = "-H", status = 2,
- stderr = expect, match=TestSCons.match_exact)
+test.run(arguments="-Z", status=2, stderr=expect, match=TestSCons.match_exact)
+
+os.environ['SCONSFLAGS'] = '-Z'
+test.run(status=2, stderr=expect, match=TestSCons.match_exact)
test.pass_test()