From 93ced7abe380898a69b21f015328f1b2b58d5b7d Mon Sep 17 00:00:00 2001 From: mes5k Date: Sun, 4 Jul 2004 03:01:48 +0000 Subject: [PATCH] allow tests --- tests/Makefile.am | 16 ++++++++++++++-- tests/test34.out | 2 ++ tests/test34.sh | 11 +++++++++++ tests/test35.out | 29 +++++++++++++++++++++++++++++ tests/test35.sh | 11 +++++++++++ tests/test36.out | 29 +++++++++++++++++++++++++++++ tests/test36.sh | 11 +++++++++++ tests/test37.out | 5 +++++ tests/test37.sh | 11 +++++++++++ tests/test38.out | 29 +++++++++++++++++++++++++++++ tests/test38.sh | 11 +++++++++++ tests/test39.out | 29 +++++++++++++++++++++++++++++ tests/test39.sh | 11 +++++++++++ 13 files changed, 203 insertions(+), 2 deletions(-) create mode 100644 tests/test34.out create mode 100755 tests/test34.sh create mode 100644 tests/test35.out create mode 100755 tests/test35.sh create mode 100644 tests/test36.out create mode 100755 tests/test36.sh create mode 100644 tests/test37.out create mode 100755 tests/test37.sh create mode 100644 tests/test38.out create mode 100755 tests/test38.sh create mode 100644 tests/test39.out create mode 100755 tests/test39.sh diff --git a/tests/Makefile.am b/tests/Makefile.am index 17789b0..85a84fa 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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 diff --git a/tests/test34.out b/tests/test34.out new file mode 100644 index 0000000..4280e73 --- /dev/null +++ b/tests/test34.out @@ -0,0 +1,2 @@ +My name is homer +My name is homer diff --git a/tests/test34.sh b/tests/test34.sh new file mode 100755 index 0000000..a11a2d6 --- /dev/null +++ b/tests/test34.sh @@ -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 + diff --git a/tests/test35.out b/tests/test35.out new file mode 100644 index 0000000..b244a84 --- /dev/null +++ b/tests/test35.out @@ -0,0 +1,29 @@ +PARSE ERROR: Argument: -n (--name) + Couldn't find 'mike' in allowed list. + + +USAGE: + + ../examples/test6 -n [--] [-v] [-h] <1,2,3> + +Where: + + -n , --name + (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 + diff --git a/tests/test35.sh b/tests/test35.sh new file mode 100755 index 0000000..e9da4a1 --- /dev/null +++ b/tests/test35.sh @@ -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 + diff --git a/tests/test36.out b/tests/test36.out new file mode 100644 index 0000000..294e615 --- /dev/null +++ b/tests/test36.out @@ -0,0 +1,29 @@ +PARSE ERROR: Argument: (--times) + Couldn't find '6' in allowed list. + + +USAGE: + + ../examples/test6 -n [--] [-v] [-h] <1,2,3> + +Where: + + -n , --name + (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 + diff --git a/tests/test36.sh b/tests/test36.sh new file mode 100755 index 0000000..e296804 --- /dev/null +++ b/tests/test36.sh @@ -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 + diff --git a/tests/test37.out b/tests/test37.out new file mode 100644 index 0000000..bb395c3 --- /dev/null +++ b/tests/test37.out @@ -0,0 +1,5 @@ +Got num 2 +Got num 1 +Got num 3 +Got name homer +Got name marge diff --git a/tests/test37.sh b/tests/test37.sh new file mode 100755 index 0000000..0792336 --- /dev/null +++ b/tests/test37.sh @@ -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 + diff --git a/tests/test38.out b/tests/test38.out new file mode 100644 index 0000000..76dcd99 --- /dev/null +++ b/tests/test38.out @@ -0,0 +1,29 @@ +PARSE ERROR: Argument: -n (--name) + Couldn't find 'mike' in allowed list. + + +USAGE: + + ../examples/test7 -n ... [--] [-v] [-h] <1,2,3> ... + +Where: + + -n , --name (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 + diff --git a/tests/test38.sh b/tests/test38.sh new file mode 100755 index 0000000..c053b8e --- /dev/null +++ b/tests/test38.sh @@ -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 + diff --git a/tests/test39.out b/tests/test39.out new file mode 100644 index 0000000..2b5d00e --- /dev/null +++ b/tests/test39.out @@ -0,0 +1,29 @@ +PARSE ERROR: Argument: (--times) + Couldn't find '6' in allowed list. + + +USAGE: + + ../examples/test7 -n ... [--] [-v] [-h] <1,2,3> ... + +Where: + + -n , --name (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 + diff --git a/tests/test39.sh b/tests/test39.sh new file mode 100755 index 0000000..8ec182b --- /dev/null +++ b/tests/test39.sh @@ -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 +