added new tests and comments

This commit is contained in:
mes5k 2004-02-04 03:14:09 +00:00
parent 510f1435e0
commit e47dc310a0
32 changed files with 216 additions and 3 deletions

View File

@ -18,7 +18,13 @@ TESTS = test1.sh \
test16.sh \
test17.sh \
test18.sh \
test19.sh
test19.sh \
test20.sh \
test21.sh \
test22.sh \
test23.sh \
test24.sh \
test25.sh
EXTRA_DIST = $(TESTS) \
test1.out \
@ -39,5 +45,11 @@ EXTRA_DIST = $(TESTS) \
test16.out \
test17.out \
test18.out \
test19.out
test19.out \
test20.out \
test21.out \
test22.out \
test23.out \
test24.out \
test25.out

View File

@ -1,5 +1,6 @@
#!/bin/sh
# success
../examples/test1 -u -n mike > tmp.out 2>&1
if cmp -s tmp.out test1.out; then

View File

@ -1,5 +1,6 @@
#!/bin/sh
# failure
../examples/test2 -i 10 -s hello > tmp.out 2>&1
if cmp -s tmp.out test10.out; then

View File

@ -1,5 +1,6 @@
#!/bin/sh
# failure
../examples/test2 -i 10 -s hello -i 9 > tmp.out 2>&1
if cmp -s tmp.out test11.out; then

View File

@ -1,5 +1,6 @@
#!/bin/sh
# failure
../examples/test2 -i 10 -s hello -f nine > tmp.out 2>&1
if cmp -s tmp.out test12.out; then

View File

@ -1,5 +1,6 @@
#!/bin/sh
# success
../examples/test3 -s=bill -i=9 -i=8 -B homer marge bart > tmp.out 2>&1
if cmp -s tmp.out test13.out; then

View File

@ -1,5 +1,6 @@
#!/bin/sh
# success
../examples/test3 -s=aaa homer marge bart -- one two > tmp.out 2>&1
if cmp -s tmp.out test14.out; then

View File

@ -1,6 +1,6 @@
#!/bin/sh
# failure
../examples/test3 -s bbb homer marge bart -- -hv two > tmp.out 2>&1
if cmp -s tmp.out test15.out; then

View File

@ -1,5 +1,6 @@
#!/bin/sh
# failure
../examples/test3 -s one homer -B -Bh > tmp.out 2>&1
if cmp -s tmp.out test16.out; then

View File

@ -1,5 +1,6 @@
#!/bin/sh
# failure
../examples/test3 -s=one homer -B > tmp.out 2>&1
if cmp -s tmp.out test17.out; then

View File

@ -1,5 +1,6 @@
#!/bin/sh
# failure
../examples/test4 -Bs --Bs asdf > tmp.out 2>&1
if cmp -s tmp.out test18.out; then

View File

@ -1,5 +1,6 @@
#!/bin/sh
# success
../examples/test4 -BA --Bs asdf > tmp.out 2>&1
if cmp -s tmp.out test19.out; then

View File

@ -1,5 +1,6 @@
#!/bin/sh
# success
../examples/test1 -n mike > tmp.out 2>&1
if cmp -s tmp.out test2.out; then

3
tests/test20.out Normal file
View File

@ -0,0 +1,3 @@
for A OR B we got : asdf
for string C we got : fdas
for string D we got : homer

11
tests/test20.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
# success
../examples/test5 -a asdf -c fdas > tmp.out 2>&1
if cmp -s tmp.out test20.out; then
exit 0
else
exit 1
fi

3
tests/test21.out Normal file
View File

@ -0,0 +1,3 @@
for A OR B we got : asdf
for string C we got : fdas
for string D we got : homer

11
tests/test21.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
# success
../examples/test5 -b asdf -c fdas > tmp.out 2>&1
if cmp -s tmp.out test21.out; then
exit 0
else
exit 1
fi

36
tests/test22.out Normal file
View File

@ -0,0 +1,36 @@
PARSE ERROR: Argument: -b (--bbb)
Argument already set!
USAGE:
../examples/test5 {-a <string>|-b <string>} [-d <string>] -c <string> [--] [-v] [-h]
Where:
-a <string>, --aaa <string>
(OR required) (value required) or test a
-- OR --
-b <string>, --bbb <string>
(OR required) (value required) or test b
-d <string>, --ddd <string>
(value required) d test
-c <string>, --ccc <string>
(required) (value required) c test
--, --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.
this is a message

11
tests/test22.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
# failure
../examples/test5 -a fdsa -b asdf -c fdas > tmp.out 2>&1
if cmp -s tmp.out test22.out; then
exit 0
else
exit 1
fi

36
tests/test23.out Normal file
View File

@ -0,0 +1,36 @@
PARSE ERROR:
One or more required arguments missing!
USAGE:
../examples/test5 {-a <string>|-b <string>} [-d <string>] -c <string> [--] [-v] [-h]
Where:
-a <string>, --aaa <string>
(OR required) (value required) or test a
-- OR --
-b <string>, --bbb <string>
(OR required) (value required) or test b
-d <string>, --ddd <string>
(value required) d test
-c <string>, --ccc <string>
(required) (value required) c test
--, --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.
this is a message

11
tests/test23.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
# failure
../examples/test5 -d junk -c fdas > tmp.out 2>&1
if cmp -s tmp.out test23.out; then
exit 0
else
exit 1
fi

36
tests/test24.out Normal file
View File

@ -0,0 +1,36 @@
PARSE ERROR: Argument: -b (--bbb)
Argument already set!
USAGE:
../examples/test5 {-a <string>|-b <string>} [-d <string>] -c <string> [--] [-v] [-h]
Where:
-a <string>, --aaa <string>
(OR required) (value required) or test a
-- OR --
-b <string>, --bbb <string>
(OR required) (value required) or test b
-d <string>, --ddd <string>
(value required) d test
-c <string>, --ccc <string>
(required) (value required) c test
--, --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.
this is a message

11
tests/test24.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
# failure
../examples/test5 --aaa dilbert -b asdf -c fdas > tmp.out 2>&1
if cmp -s tmp.out test24.out; then
exit 0
else
exit 1
fi

3
tests/test25.out Normal file
View File

@ -0,0 +1,3 @@
for A OR B we got : asdf
for string C we got : fdas
for string D we got : homer

11
tests/test25.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
# success
../examples/test5 --aaa asdf -c fdas > tmp.out 2>&1
if cmp -s tmp.out test25.out; then
exit 0
else
exit 1
fi

View File

@ -1,5 +1,6 @@
#!/bin/sh
# success
../examples/test1 -n mike -u > tmp.out 2>&1
if cmp -s tmp.out test3.out; then

View File

@ -1,5 +1,6 @@
#!/bin/sh
# failure
../examples/test1 > tmp.out 2>&1
if cmp -s tmp.out test4.out; then

View File

@ -1,5 +1,6 @@
#!/bin/sh
# success
../examples/test2 -i 10 -s homer marge bart lisa > tmp.out 2>&1
if cmp -s tmp.out test5.out; then

View File

@ -1,5 +1,6 @@
#!/bin/sh
# success
../examples/test2 -i 10 -s hello goodbye -ABC > tmp.out 2>&1
if cmp -s tmp.out test6.out; then

View File

@ -1,5 +1,6 @@
#!/bin/sh
# failure
../examples/test2 -i 10 -s hello goodbye -hABC > tmp.out 2>&1
if cmp -s tmp.out test7.out; then

View File

@ -1,5 +1,6 @@
#!/bin/sh
# success
../examples/test2 -v > tmp.out 2>&1
if cmp -s tmp.out test8.out; then

View File

@ -1,5 +1,6 @@
#!/bin/sh
# success
../examples/test2 -i 10 -s hello goodbye -- -hv one two > tmp.out 2>&1
if cmp -s tmp.out test9.out; then