Mercurial > hg > octave-lojdl > gnulib-hg
comparison modules/getopt-posix-tests @ 12474:266f24fed73e
test-getopt: test stderr behavior
Portions of this commit are commented out because they tickle
glibc bugs. For a real-life example of the bug:
$ env -ua -:
env: invalid option -- :
Try `env --help' for more information.
$ env -:
env: invalid option -- :
Try `env --help' for more information.
$ env -+
env: invalid option -- +
Try `env --help' for more information.
$ env -ua -+
Try `env --help' for more information.
Notice that when -+ is not given as the first argument, the
error message is mistakenly suppressed.
* modules/getopt-posix-tests (Depends-on): Add dup2.
* tests/test-getopt.c (ASSERT): Avoid stderr.
(main): Move stderr to a temporary file.
* tests/test-getopt.h (getopt_loop): No longer manipulate opterr.
Instead, add parameter to inform caller if output occurred.
(test_getopt): Adjust all tests to expect silence, and add new
tests of leading ":".
* doc/glibc-functions/getopt_long.texi (getopt_long): Document
glibc shortcomings with leading "-:" or "+:" in optstring.
* doc/glibc-functions/getopt_long_only.texi (getopt_long_only):
Likewise.
* doc/posix-functions/getopt.texi (getopt): Likewise.
Signed-off-by: Eric Blake <ebb9@byu.net>
author | Eric Blake <ebb9@byu.net> |
---|---|
date | Wed, 02 Dec 2009 15:48:08 -0700 |
parents | 9f4c9181d1d6 |
children | 33ab12a7cea2 |
comparison
equal
deleted
inserted
replaced
12473:81590e0c5feb | 12474:266f24fed73e |
---|---|
2 tests/test-getopt.c | 2 tests/test-getopt.c |
3 tests/test-getopt.h | 3 tests/test-getopt.h |
4 tests/test-getopt_long.h | 4 tests/test-getopt_long.h |
5 | 5 |
6 Depends-on: | 6 Depends-on: |
7 dup2 | |
7 setenv | 8 setenv |
8 stdbool | 9 stdbool |
9 unistd | 10 unistd |
10 unsetenv | 11 unsetenv |
11 | 12 |