test-getopt: enhance test
authorEric Blake <ebb9@byu.net>
Wed, 2 Dec 2009 00:21:34 +0000 (17:21 -0700)
committerEric Blake <ebb9@byu.net>
Tue, 22 Dec 2009 13:42:33 +0000 (06:42 -0700)
commita8ec28b6975fc065b84c511b8108dc3658d2ccd4
tree0ad3e9a11b9a04b5c5294f811c6160993e65f5dc
parent2c77d283b12521cd05a63a4188f68cd595b0a8f9
test-getopt: enhance test

Add coverage of optind==0 for getopt_long, since coreutils
depends on it.  Also test an optstring containing "W;", since
that tends to expose corner-case bugs (even in glibc, so the
test is weaker than it could be).

* m4/getopt.m4 (gl_GETOPT_CHECK_HEADERS): Require that getopt_long
supports optind=0.
* tests/test-getopt.c (OPTIND_MIN): Move...
* tests/test-getopt.h (OPTIND_MIN): ...here.
* tests/test-getopt_long.h (test_getopt_long): Add more coverage.
Require that optind=0 works, since modern BSD supports it in
addition to optreset, and since coreutils expects it.
(test_getopt_long_only): New test.
* doc/glibc-functions/getopt_long.texi (getopt_long): Document
glibc shortcomings with 'W;', and enforcement of optind=0.
* doc/glibc-functions/getopt_long_only.texi (getopt_long_only):
Likewise.
ChangeLog
doc/glibc-functions/getopt_long.texi
doc/glibc-functions/getopt_long_only.texi
m4/getopt.m4
tests/test-getopt.c
tests/test-getopt.h
tests/test-getopt_long.h