mirror of
https://github.com/cuberite/TCLAP.git
synced 2025-09-11 13:14:45 -04:00
added tests for reading extra incorrect values from arg
This commit is contained in:
parent
3c577f0576
commit
47153d7c6d
@ -24,7 +24,14 @@ TESTS = test1.sh \
|
||||
test22.sh \
|
||||
test23.sh \
|
||||
test24.sh \
|
||||
test25.sh
|
||||
test25.sh \
|
||||
test26.sh \
|
||||
test27.sh \
|
||||
test28.sh \
|
||||
test29.sh \
|
||||
test30.sh \
|
||||
test31.sh \
|
||||
test32.sh
|
||||
|
||||
EXTRA_DIST = $(TESTS) \
|
||||
test1.out \
|
||||
@ -51,5 +58,12 @@ EXTRA_DIST = $(TESTS) \
|
||||
test22.out \
|
||||
test23.out \
|
||||
test24.out \
|
||||
test25.out
|
||||
test25.out \
|
||||
test26.out \
|
||||
test27.out \
|
||||
test28.out \
|
||||
test29.out \
|
||||
test30.out \
|
||||
test31.out \
|
||||
test32.out
|
||||
|
||||
|
47
tests/test26.out
Normal file
47
tests/test26.out
Normal file
@ -0,0 +1,47 @@
|
||||
PARSE ERROR: Argument: -f (--floatTest)
|
||||
More than one valid value parsed from string '4..2'
|
||||
|
||||
|
||||
USAGE:
|
||||
|
||||
../examples/test2 [-f <float>] -i <int> -s <string> [-A] [-C] [-B] [--] [-v] [-h] <string> <string> ...
|
||||
|
||||
Where:
|
||||
|
||||
-f <float>, --floatTest <float>
|
||||
(value required) float test
|
||||
|
||||
-i <int>, --intTest <int>
|
||||
(required) (value required) integer test
|
||||
|
||||
-s <string>, --stringTest <string>
|
||||
(required) (value required) string test
|
||||
|
||||
-A, --existTestA
|
||||
tests for the existence of A
|
||||
|
||||
-C, --existTestC
|
||||
tests for the existence of C
|
||||
|
||||
-B, --existTestB
|
||||
tests for the existence of B
|
||||
|
||||
--, --ignore_rest
|
||||
Ignores the rest of the labeled arguments following this flag.
|
||||
|
||||
-v, --version
|
||||
Displays version information and exits.
|
||||
|
||||
-h, --help
|
||||
Displays usage information and exits.
|
||||
|
||||
<string>
|
||||
(required) (value required) unlabeld test
|
||||
|
||||
<string> (accepted multiple times)
|
||||
(value required) file names
|
||||
|
||||
|
||||
|
||||
this is a message
|
||||
|
11
tests/test26.sh
Executable file
11
tests/test26.sh
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
# failure
|
||||
../examples/test2 -i 2 -f 4..2 -s asdf asdf > tmp.out 2>&1
|
||||
|
||||
if cmp -s tmp.out test26.out; then
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
|
47
tests/test27.out
Normal file
47
tests/test27.out
Normal file
@ -0,0 +1,47 @@
|
||||
PARSE ERROR: Argument: -f (--floatTest)
|
||||
More than one valid value parsed from string '4.0.2'
|
||||
|
||||
|
||||
USAGE:
|
||||
|
||||
../examples/test2 [-f <float>] -i <int> -s <string> [-A] [-C] [-B] [--] [-v] [-h] <string> <string> ...
|
||||
|
||||
Where:
|
||||
|
||||
-f <float>, --floatTest <float>
|
||||
(value required) float test
|
||||
|
||||
-i <int>, --intTest <int>
|
||||
(required) (value required) integer test
|
||||
|
||||
-s <string>, --stringTest <string>
|
||||
(required) (value required) string test
|
||||
|
||||
-A, --existTestA
|
||||
tests for the existence of A
|
||||
|
||||
-C, --existTestC
|
||||
tests for the existence of C
|
||||
|
||||
-B, --existTestB
|
||||
tests for the existence of B
|
||||
|
||||
--, --ignore_rest
|
||||
Ignores the rest of the labeled arguments following this flag.
|
||||
|
||||
-v, --version
|
||||
Displays version information and exits.
|
||||
|
||||
-h, --help
|
||||
Displays usage information and exits.
|
||||
|
||||
<string>
|
||||
(required) (value required) unlabeld test
|
||||
|
||||
<string> (accepted multiple times)
|
||||
(value required) file names
|
||||
|
||||
|
||||
|
||||
this is a message
|
||||
|
11
tests/test27.sh
Executable file
11
tests/test27.sh
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
# failure
|
||||
../examples/test2 -i 2 -f 4.0.2 -s asdf asdf > tmp.out 2>&1
|
||||
|
||||
if cmp -s tmp.out test27.out; then
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
|
47
tests/test28.out
Normal file
47
tests/test28.out
Normal file
@ -0,0 +1,47 @@
|
||||
PARSE ERROR: Argument: -i (--intTest)
|
||||
Couldn't read argument value from string '2a'
|
||||
|
||||
|
||||
USAGE:
|
||||
|
||||
../examples/test2 [-f <float>] -i <int> -s <string> [-A] [-C] [-B] [--] [-v] [-h] <string> <string> ...
|
||||
|
||||
Where:
|
||||
|
||||
-f <float>, --floatTest <float>
|
||||
(value required) float test
|
||||
|
||||
-i <int>, --intTest <int>
|
||||
(required) (value required) integer test
|
||||
|
||||
-s <string>, --stringTest <string>
|
||||
(required) (value required) string test
|
||||
|
||||
-A, --existTestA
|
||||
tests for the existence of A
|
||||
|
||||
-C, --existTestC
|
||||
tests for the existence of C
|
||||
|
||||
-B, --existTestB
|
||||
tests for the existence of B
|
||||
|
||||
--, --ignore_rest
|
||||
Ignores the rest of the labeled arguments following this flag.
|
||||
|
||||
-v, --version
|
||||
Displays version information and exits.
|
||||
|
||||
-h, --help
|
||||
Displays usage information and exits.
|
||||
|
||||
<string>
|
||||
(required) (value required) unlabeld test
|
||||
|
||||
<string> (accepted multiple times)
|
||||
(value required) file names
|
||||
|
||||
|
||||
|
||||
this is a message
|
||||
|
11
tests/test28.sh
Executable file
11
tests/test28.sh
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
# failure
|
||||
../examples/test2 -i 2a -f 4.2 -s asdf asdf > tmp.out 2>&1
|
||||
|
||||
if cmp -s tmp.out test28.out; then
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
|
47
tests/test29.out
Normal file
47
tests/test29.out
Normal file
@ -0,0 +1,47 @@
|
||||
PARSE ERROR: Argument: -i (--intTest)
|
||||
Couldn't read argument value from string '0x2'
|
||||
|
||||
|
||||
USAGE:
|
||||
|
||||
../examples/test2 [-f <float>] -i <int> -s <string> [-A] [-C] [-B] [--] [-v] [-h] <string> <string> ...
|
||||
|
||||
Where:
|
||||
|
||||
-f <float>, --floatTest <float>
|
||||
(value required) float test
|
||||
|
||||
-i <int>, --intTest <int>
|
||||
(required) (value required) integer test
|
||||
|
||||
-s <string>, --stringTest <string>
|
||||
(required) (value required) string test
|
||||
|
||||
-A, --existTestA
|
||||
tests for the existence of A
|
||||
|
||||
-C, --existTestC
|
||||
tests for the existence of C
|
||||
|
||||
-B, --existTestB
|
||||
tests for the existence of B
|
||||
|
||||
--, --ignore_rest
|
||||
Ignores the rest of the labeled arguments following this flag.
|
||||
|
||||
-v, --version
|
||||
Displays version information and exits.
|
||||
|
||||
-h, --help
|
||||
Displays usage information and exits.
|
||||
|
||||
<string>
|
||||
(required) (value required) unlabeld test
|
||||
|
||||
<string> (accepted multiple times)
|
||||
(value required) file names
|
||||
|
||||
|
||||
|
||||
this is a message
|
||||
|
11
tests/test29.sh
Executable file
11
tests/test29.sh
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
# failure ! ack no hex :(
|
||||
../examples/test2 -i 0x2 -f 4.2 -s asdf asdf > tmp.out 2>&1
|
||||
|
||||
if cmp -s tmp.out test29.out; then
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
|
47
tests/test30.out
Normal file
47
tests/test30.out
Normal file
@ -0,0 +1,47 @@
|
||||
PARSE ERROR: Argument: -i (--intTest)
|
||||
Couldn't read argument value from string '2.1'
|
||||
|
||||
|
||||
USAGE:
|
||||
|
||||
../examples/test2 [-f <float>] -i <int> -s <string> [-A] [-C] [-B] [--] [-v] [-h] <string> <string> ...
|
||||
|
||||
Where:
|
||||
|
||||
-f <float>, --floatTest <float>
|
||||
(value required) float test
|
||||
|
||||
-i <int>, --intTest <int>
|
||||
(required) (value required) integer test
|
||||
|
||||
-s <string>, --stringTest <string>
|
||||
(required) (value required) string test
|
||||
|
||||
-A, --existTestA
|
||||
tests for the existence of A
|
||||
|
||||
-C, --existTestC
|
||||
tests for the existence of C
|
||||
|
||||
-B, --existTestB
|
||||
tests for the existence of B
|
||||
|
||||
--, --ignore_rest
|
||||
Ignores the rest of the labeled arguments following this flag.
|
||||
|
||||
-v, --version
|
||||
Displays version information and exits.
|
||||
|
||||
-h, --help
|
||||
Displays usage information and exits.
|
||||
|
||||
<string>
|
||||
(required) (value required) unlabeld test
|
||||
|
||||
<string> (accepted multiple times)
|
||||
(value required) file names
|
||||
|
||||
|
||||
|
||||
this is a message
|
||||
|
11
tests/test30.sh
Executable file
11
tests/test30.sh
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
# failure
|
||||
../examples/test2 -i 2.1 -f 4.2 -s asdf asdf > tmp.out 2>&1
|
||||
|
||||
if cmp -s tmp.out test30.out; then
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
|
44
tests/test31.out
Normal file
44
tests/test31.out
Normal file
@ -0,0 +1,44 @@
|
||||
PARSE ERROR: Argument: -i (--intTest)
|
||||
Couldn't read argument value from string '9a'
|
||||
|
||||
|
||||
USAGE:
|
||||
|
||||
../examples/test3 [-f=<float>] ... [-i=<int>] ... -s=<string> [-B] [--] [-v] [-h] <string> <string> <fileNameString> ...
|
||||
|
||||
Where:
|
||||
|
||||
-f <float>, --floatTest <float> (accepted multiple times)
|
||||
(value required) multi float test
|
||||
|
||||
-i <int>, --intTest <int> (accepted multiple times)
|
||||
(value required) multi int test
|
||||
|
||||
-s <string>, --stringTest <string>
|
||||
(required) (value required) string test
|
||||
|
||||
-B, --existTest B
|
||||
exist Test B
|
||||
|
||||
--, --ignore_rest
|
||||
Ignores the rest of the labeled arguments following this flag.
|
||||
|
||||
-v, --version
|
||||
Displays version information and exits.
|
||||
|
||||
-h, --help
|
||||
Displays usage information and exits.
|
||||
|
||||
<string>
|
||||
(required) (value required) unlabeled test one
|
||||
|
||||
<string>
|
||||
(required) (value required) unlabeled test two
|
||||
|
||||
<fileNameString> (accepted multiple times)
|
||||
(value required) file names
|
||||
|
||||
|
||||
|
||||
this is a message
|
||||
|
11
tests/test31.sh
Executable file
11
tests/test31.sh
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
# failure
|
||||
../examples/test3 -i=9a -i=1 -s=asdf asdf asdf > tmp.out 2>&1
|
||||
|
||||
if cmp -s tmp.out test31.out; then
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
|
44
tests/test32.out
Normal file
44
tests/test32.out
Normal file
@ -0,0 +1,44 @@
|
||||
PARSE ERROR: Argument: -f (--floatTest)
|
||||
More than one valid value parsed from string '1.0.0'
|
||||
|
||||
|
||||
USAGE:
|
||||
|
||||
../examples/test3 [-f=<float>] ... [-i=<int>] ... -s=<string> [-B] [--] [-v] [-h] <string> <string> <fileNameString> ...
|
||||
|
||||
Where:
|
||||
|
||||
-f <float>, --floatTest <float> (accepted multiple times)
|
||||
(value required) multi float test
|
||||
|
||||
-i <int>, --intTest <int> (accepted multiple times)
|
||||
(value required) multi int test
|
||||
|
||||
-s <string>, --stringTest <string>
|
||||
(required) (value required) string test
|
||||
|
||||
-B, --existTest B
|
||||
exist Test B
|
||||
|
||||
--, --ignore_rest
|
||||
Ignores the rest of the labeled arguments following this flag.
|
||||
|
||||
-v, --version
|
||||
Displays version information and exits.
|
||||
|
||||
-h, --help
|
||||
Displays usage information and exits.
|
||||
|
||||
<string>
|
||||
(required) (value required) unlabeled test one
|
||||
|
||||
<string>
|
||||
(required) (value required) unlabeled test two
|
||||
|
||||
<fileNameString> (accepted multiple times)
|
||||
(value required) file names
|
||||
|
||||
|
||||
|
||||
this is a message
|
||||
|
11
tests/test32.sh
Executable file
11
tests/test32.sh
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
# failure
|
||||
../examples/test3 -f=9 -f=1.0.0 -s=asdf asdf asdf > tmp.out 2>&1
|
||||
|
||||
if cmp -s tmp.out test32.out; then
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user