diff --git a/tests/Makefile.am b/tests/Makefile.am index 1462f2c..7bc5c1f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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 diff --git a/tests/test1.sh b/tests/test1.sh index e0c8c18..872962f 100755 --- a/tests/test1.sh +++ b/tests/test1.sh @@ -1,5 +1,6 @@ #!/bin/sh +# success ../examples/test1 -u -n mike > tmp.out 2>&1 if cmp -s tmp.out test1.out; then diff --git a/tests/test10.sh b/tests/test10.sh index 8a818ff..ac0a749 100755 --- a/tests/test10.sh +++ b/tests/test10.sh @@ -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 diff --git a/tests/test11.sh b/tests/test11.sh index a62d816..aab945b 100755 --- a/tests/test11.sh +++ b/tests/test11.sh @@ -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 diff --git a/tests/test12.sh b/tests/test12.sh index aa60f63..1e3e21d 100755 --- a/tests/test12.sh +++ b/tests/test12.sh @@ -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 diff --git a/tests/test13.sh b/tests/test13.sh index 24aaf98..ed4fc92 100755 --- a/tests/test13.sh +++ b/tests/test13.sh @@ -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 diff --git a/tests/test14.sh b/tests/test14.sh index c6ae78b..f26d43b 100755 --- a/tests/test14.sh +++ b/tests/test14.sh @@ -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 diff --git a/tests/test15.sh b/tests/test15.sh index 2a261e6..6719da4 100755 --- a/tests/test15.sh +++ b/tests/test15.sh @@ -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 diff --git a/tests/test16.sh b/tests/test16.sh index bf7bbf7..4e9ab4b 100755 --- a/tests/test16.sh +++ b/tests/test16.sh @@ -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 diff --git a/tests/test17.sh b/tests/test17.sh index 122e56d..5cb6224 100755 --- a/tests/test17.sh +++ b/tests/test17.sh @@ -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 diff --git a/tests/test18.sh b/tests/test18.sh index 2e50b9b..8da4fb9 100755 --- a/tests/test18.sh +++ b/tests/test18.sh @@ -1,5 +1,6 @@ #!/bin/sh +# failure ../examples/test4 -Bs --Bs asdf > tmp.out 2>&1 if cmp -s tmp.out test18.out; then diff --git a/tests/test19.sh b/tests/test19.sh index 7ef10c4..5ccc2cf 100755 --- a/tests/test19.sh +++ b/tests/test19.sh @@ -1,5 +1,6 @@ #!/bin/sh +# success ../examples/test4 -BA --Bs asdf > tmp.out 2>&1 if cmp -s tmp.out test19.out; then diff --git a/tests/test2.sh b/tests/test2.sh index 5403e7a..a3c4045 100755 --- a/tests/test2.sh +++ b/tests/test2.sh @@ -1,5 +1,6 @@ #!/bin/sh +# success ../examples/test1 -n mike > tmp.out 2>&1 if cmp -s tmp.out test2.out; then diff --git a/tests/test20.out b/tests/test20.out new file mode 100644 index 0000000..7553e05 --- /dev/null +++ b/tests/test20.out @@ -0,0 +1,3 @@ +for A OR B we got : asdf +for string C we got : fdas +for string D we got : homer diff --git a/tests/test20.sh b/tests/test20.sh new file mode 100755 index 0000000..377f2dd --- /dev/null +++ b/tests/test20.sh @@ -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 + diff --git a/tests/test21.out b/tests/test21.out new file mode 100644 index 0000000..7553e05 --- /dev/null +++ b/tests/test21.out @@ -0,0 +1,3 @@ +for A OR B we got : asdf +for string C we got : fdas +for string D we got : homer diff --git a/tests/test21.sh b/tests/test21.sh new file mode 100755 index 0000000..7eac9c8 --- /dev/null +++ b/tests/test21.sh @@ -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 + diff --git a/tests/test22.out b/tests/test22.out new file mode 100644 index 0000000..b4ee4f1 --- /dev/null +++ b/tests/test22.out @@ -0,0 +1,36 @@ +PARSE ERROR: Argument: -b (--bbb) + Argument already set! + + +USAGE: + + ../examples/test5 {-a |-b } [-d ] -c [--] [-v] [-h] + +Where: + + -a , --aaa + (OR required) (value required) or test a + -- OR -- + -b , --bbb + (OR required) (value required) or test b + + + -d , --ddd + (value required) d test + + -c , --ccc + (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 + diff --git a/tests/test22.sh b/tests/test22.sh new file mode 100755 index 0000000..af447f9 --- /dev/null +++ b/tests/test22.sh @@ -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 + diff --git a/tests/test23.out b/tests/test23.out new file mode 100644 index 0000000..ff7871b --- /dev/null +++ b/tests/test23.out @@ -0,0 +1,36 @@ +PARSE ERROR: + One or more required arguments missing! + + +USAGE: + + ../examples/test5 {-a |-b } [-d ] -c [--] [-v] [-h] + +Where: + + -a , --aaa + (OR required) (value required) or test a + -- OR -- + -b , --bbb + (OR required) (value required) or test b + + + -d , --ddd + (value required) d test + + -c , --ccc + (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 + diff --git a/tests/test23.sh b/tests/test23.sh new file mode 100755 index 0000000..784ffcd --- /dev/null +++ b/tests/test23.sh @@ -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 + diff --git a/tests/test24.out b/tests/test24.out new file mode 100644 index 0000000..b4ee4f1 --- /dev/null +++ b/tests/test24.out @@ -0,0 +1,36 @@ +PARSE ERROR: Argument: -b (--bbb) + Argument already set! + + +USAGE: + + ../examples/test5 {-a |-b } [-d ] -c [--] [-v] [-h] + +Where: + + -a , --aaa + (OR required) (value required) or test a + -- OR -- + -b , --bbb + (OR required) (value required) or test b + + + -d , --ddd + (value required) d test + + -c , --ccc + (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 + diff --git a/tests/test24.sh b/tests/test24.sh new file mode 100755 index 0000000..94a92f9 --- /dev/null +++ b/tests/test24.sh @@ -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 + diff --git a/tests/test25.out b/tests/test25.out new file mode 100644 index 0000000..7553e05 --- /dev/null +++ b/tests/test25.out @@ -0,0 +1,3 @@ +for A OR B we got : asdf +for string C we got : fdas +for string D we got : homer diff --git a/tests/test25.sh b/tests/test25.sh new file mode 100755 index 0000000..b30538e --- /dev/null +++ b/tests/test25.sh @@ -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 + diff --git a/tests/test3.sh b/tests/test3.sh index 71cb8f1..1ca0dba 100755 --- a/tests/test3.sh +++ b/tests/test3.sh @@ -1,5 +1,6 @@ #!/bin/sh +# success ../examples/test1 -n mike -u > tmp.out 2>&1 if cmp -s tmp.out test3.out; then diff --git a/tests/test4.sh b/tests/test4.sh index 26f4009..867dbb5 100755 --- a/tests/test4.sh +++ b/tests/test4.sh @@ -1,5 +1,6 @@ #!/bin/sh +# failure ../examples/test1 > tmp.out 2>&1 if cmp -s tmp.out test4.out; then diff --git a/tests/test5.sh b/tests/test5.sh index dbbd17e..c919532 100755 --- a/tests/test5.sh +++ b/tests/test5.sh @@ -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 diff --git a/tests/test6.sh b/tests/test6.sh index a6e3f75..23e79b7 100755 --- a/tests/test6.sh +++ b/tests/test6.sh @@ -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 diff --git a/tests/test7.sh b/tests/test7.sh index 71120b5..6772823 100755 --- a/tests/test7.sh +++ b/tests/test7.sh @@ -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 diff --git a/tests/test8.sh b/tests/test8.sh index edbf44f..d98b346 100755 --- a/tests/test8.sh +++ b/tests/test8.sh @@ -1,5 +1,6 @@ #!/bin/sh +# success ../examples/test2 -v > tmp.out 2>&1 if cmp -s tmp.out test8.out; then diff --git a/tests/test9.sh b/tests/test9.sh index 7ef0eee..ac1a582 100755 --- a/tests/test9.sh +++ b/tests/test9.sh @@ -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