mirror of
https://github.com/cuberite/TCLAP.git
synced 2025-08-04 02:06:29 -04:00
made a fix for a bug where - chars were within unlabeled value args
This commit is contained in:
parent
ccf8ea17f1
commit
db4133a981
@ -150,7 +150,8 @@ inline bool SwitchArg::combinedSwitchesMatch(std::string& combinedSwitches )
|
||||
// ok, we're not specifying a ValueArg, so we know that we have
|
||||
// a combined switch list.
|
||||
for ( unsigned int i = 1; i < combinedSwitches.length(); i++ )
|
||||
if ( combinedSwitches[i] == _flag[0] )
|
||||
if ( combinedSwitches[i] == _flag[0] &&
|
||||
_flag[0] != Arg::flagStartString()[0] )
|
||||
{
|
||||
// update the combined switches so this one is no longer present
|
||||
// this is necessary so that no unlabeled args are matched
|
||||
|
@ -59,7 +59,8 @@ TESTS = test1.sh \
|
||||
test57.sh \
|
||||
test58.sh \
|
||||
test59.sh \
|
||||
test60.sh
|
||||
test60.sh \
|
||||
test61.sh
|
||||
|
||||
EXTRA_DIST = $(TESTS) \
|
||||
test1.out \
|
||||
@ -121,6 +122,7 @@ EXTRA_DIST = $(TESTS) \
|
||||
test57.out \
|
||||
test58.out \
|
||||
test59.out \
|
||||
test60.out
|
||||
test60.out \
|
||||
test61.out
|
||||
|
||||
CLEANFILES = tmp.out
|
||||
|
7
tests/test61.out
Normal file
7
tests/test61.out
Normal file
@ -0,0 +1,7 @@
|
||||
for float we got : 3.7
|
||||
for int we got : 10
|
||||
for string we got : hello
|
||||
for ulabeled we got : -1 -1
|
||||
for bool A we got : 0
|
||||
for bool B we got : 0
|
||||
for bool C we got : 0
|
12
tests/test61.sh
Executable file
12
tests/test61.sh
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
# this tests a bug in handling of - chars in Unlabeled args
|
||||
# success
|
||||
../examples/test2 -i 10 -s hello "-1 -1" > tmp.out 2>&1
|
||||
|
||||
if cmp -s tmp.out $srcdir/test61.out; then
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user