From 7262b15ac8f8ffee07170747b9a94bf2bd7e09ff Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Sat, 7 Dec 2002 19:57:25 +0000 Subject: Add test for fix in revision 1.5 of getopt_long.c --- regress/lib/libc/getopt_long/Makefile | 6 +++++- regress/lib/libc/getopt_long/getopt_long_test.c | 1 + regress/lib/libc/getopt_long/test.ok | 20 ++++++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) (limited to 'regress/lib/libc') diff --git a/regress/lib/libc/getopt_long/Makefile b/regress/lib/libc/getopt_long/Makefile index b5dd3435379..77292610792 100644 --- a/regress/lib/libc/getopt_long/Makefile +++ b/regress/lib/libc/getopt_long/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.2 2002/12/05 22:29:46 millert Exp $ +# $OpenBSD: Makefile,v 1.3 2002/12/07 19:57:24 millert Exp $ NOMAN= PROG=getopt_long_test @@ -9,18 +9,22 @@ run-regress-${PROG}: ${PROG} test -n "$$LONG_ONLY" && unset LONG_ONLY; \ ./${PROG} myfile --force -f infile -9 ; \ ./${PROG} onefile twofile --best -Williterate -i foo.in threefile ; \ + ./${PROG} -1bfast ; \ ./${PROG} --fast --drinking=guiness -i foo.in somefile ; \ export POSIXLY_CORRECT=1 ; \ ./${PROG} myfile --force -f infile -9 ; \ ./${PROG} onefile twofile --best -Williterate -i foo.in threefile ; \ + ./${PROG} -1bfast ; \ ./${PROG} --fast --drinking=guiness -i foo.in somefile ; \ unset POSIXLY_CORRECT ; export LONG_ONLY=1 ; \ ./${PROG} myfile -force -f infile -9 ; \ ./${PROG} onefile twofile -best -Williterate -i foo.in threefile ; \ + ./${PROG} -1bfast ; \ ./${PROG} --fast -drinking=guiness -i foo.in somefile ; \ export POSIXLY_CORRECT=1 ; \ ./${PROG} myfile -force -f infile -9 ; \ ./${PROG} onefile twofile -best -Williterate -i foo.in threefile ; \ + ./${PROG} -1bfast ; \ ./${PROG} --fast -drinking=guiness -i foo.in somefile ) >test.out 2>&1 cmp -s ${.OBJDIR}/test.out ${.CURDIR}/test.ok diff --git a/regress/lib/libc/getopt_long/getopt_long_test.c b/regress/lib/libc/getopt_long/getopt_long_test.c index acd25fb7495..b15613d9826 100644 --- a/regress/lib/libc/getopt_long/getopt_long_test.c +++ b/regress/lib/libc/getopt_long/getopt_long_test.c @@ -75,6 +75,7 @@ main(int argc, char **argv) case '1': case '9': case 'h': + case 'b': if (idx != -1) { if (goggles == 42) printf("option %s, arg %s\n", diff --git a/regress/lib/libc/getopt_long/test.ok b/regress/lib/libc/getopt_long/test.ok index 809577f2c83..124422f964d 100644 --- a/regress/lib/libc/getopt_long/test.ok +++ b/regress/lib/libc/getopt_long/test.ok @@ -10,6 +10,11 @@ option illiterate option i, arg foo.in remaining ARGV: onefile twofile threefile +getopt_long: -1bfast +option 1 +option b +option f, arg ast + getopt_long: --fast --drinking=guiness -i foo.in somefile option fast option drinking, arg guiness @@ -22,6 +27,11 @@ remaining ARGV: myfile --force -f infile -9 getopt_long (POSIXLY_CORRECT): onefile twofile --best -Williterate -i foo.in threefile remaining ARGV: onefile twofile --best -Williterate -i foo.in threefile +getopt_long (POSIXLY_CORRECT): -1bfast +option 1 +option b +option f, arg ast + getopt_long (POSIXLY_CORRECT): --fast --drinking=guiness -i foo.in somefile option fast option drinking, arg guiness @@ -40,6 +50,11 @@ option illiterate option i, arg foo.in remaining ARGV: onefile twofile threefile +getopt_long_only: -1bfast +option 1 +option b +option fast + getopt_long_only: --fast -drinking=guiness -i foo.in somefile option fast option drinking, arg guiness @@ -52,6 +67,11 @@ remaining ARGV: myfile -force -f infile -9 getopt_long_only (POSIXLY_CORRECT): onefile twofile -best -Williterate -i foo.in threefile remaining ARGV: onefile twofile -best -Williterate -i foo.in threefile +getopt_long_only (POSIXLY_CORRECT): -1bfast +option 1 +option b +option fast + getopt_long_only (POSIXLY_CORRECT): --fast -drinking=guiness -i foo.in somefile option fast option drinking, arg guiness -- cgit v1.2.3