allow tests

This commit is contained in:
mes5k 2004-07-04 03:01:48 +00:00
parent 8895edd174
commit 93ced7abe3
13 changed files with 203 additions and 2 deletions

View File

@ -32,7 +32,13 @@ TESTS = test1.sh \
test30.sh \
test31.sh \
test32.sh \
test33.sh
test33.sh \
test34.sh \
test35.sh \
test36.sh \
test37.sh \
test38.sh \
test39.sh
EXTRA_DIST = $(TESTS) \
test1.out \
@ -67,5 +73,11 @@ EXTRA_DIST = $(TESTS) \
test30.out \
test31.out \
test32.out \
test33.out
test33.out \
test34.out \
test35.out \
test36.out \
test37.out \
test38.out \
test39.out

2
tests/test34.out Normal file
View File

@ -0,0 +1,2 @@
My name is homer
My name is homer

11
tests/test34.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
# success
../examples/test6 -n homer 2 > tmp.out 2>&1
if cmp -s tmp.out test34.out; then
exit 0
else
exit 1
fi

29
tests/test35.out Normal file
View File

@ -0,0 +1,29 @@
PARSE ERROR: Argument: -n (--name)
Couldn't find 'mike' in allowed list.
USAGE:
../examples/test6 -n <homer,marge,bart,lisa,maggie> [--] [-v] [-h] <1,2,3>
Where:
-n <homer,marge,bart,lisa,maggie>, --name <homer,marge,bart,lisa,maggie>
(required) (value required) Name to print
--, --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.
<1,2,3>
(required) (value required) Number of times to print
Command description message

11
tests/test35.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
# failure
../examples/test6 -n mike 2 > tmp.out 2>&1
if cmp -s tmp.out test35.out; then
exit 0
else
exit 1
fi

29
tests/test36.out Normal file
View File

@ -0,0 +1,29 @@
PARSE ERROR: Argument: (--times)
Couldn't find '6' in allowed list.
USAGE:
../examples/test6 -n <homer,marge,bart,lisa,maggie> [--] [-v] [-h] <1,2,3>
Where:
-n <homer,marge,bart,lisa,maggie>, --name <homer,marge,bart,lisa,maggie>
(required) (value required) Name to print
--, --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.
<1,2,3>
(required) (value required) Number of times to print
Command description message

11
tests/test36.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
# failure
../examples/test6 -n homer 6 > tmp.out 2>&1
if cmp -s tmp.out test36.out; then
exit 0
else
exit 1
fi

5
tests/test37.out Normal file
View File

@ -0,0 +1,5 @@
Got num 2
Got num 1
Got num 3
Got name homer
Got name marge

11
tests/test37.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
# success
../examples/test7 -n homer 2 -n marge 1 3 > tmp.out 2>&1
if cmp -s tmp.out test37.out; then
exit 0
else
exit 1
fi

29
tests/test38.out Normal file
View File

@ -0,0 +1,29 @@
PARSE ERROR: Argument: -n (--name)
Couldn't find 'mike' in allowed list.
USAGE:
../examples/test7 -n <homer,marge,bart,lisa,maggie> ... [--] [-v] [-h] <1,2,3> ...
Where:
-n <homer,marge,bart,lisa,maggie>, --name <homer,marge,bart,lisa,maggie> (accepted multiple times)
(required) (value required) Name to print
--, --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.
<1,2,3> (accepted multiple times)
(value required) Number of times to print
Command description message

11
tests/test38.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
# failure
../examples/test7 -n mike 2 1 > tmp.out 2>&1
if cmp -s tmp.out test38.out; then
exit 0
else
exit 1
fi

29
tests/test39.out Normal file
View File

@ -0,0 +1,29 @@
PARSE ERROR: Argument: (--times)
Couldn't find '6' in allowed list.
USAGE:
../examples/test7 -n <homer,marge,bart,lisa,maggie> ... [--] [-v] [-h] <1,2,3> ...
Where:
-n <homer,marge,bart,lisa,maggie>, --name <homer,marge,bart,lisa,maggie> (accepted multiple times)
(required) (value required) Name to print
--, --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.
<1,2,3> (accepted multiple times)
(value required) Number of times to print
Command description message

11
tests/test39.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
# failure
../examples/test7 2 -n homer -n bart 6 > tmp.out 2>&1
if cmp -s tmp.out test39.out; then
exit 0
else
exit 1
fi