X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-getopt_long.h;h=07ea4a28fd4ae0c4ca58d5d97d9381de34d20341;hb=cd56634a4a8179fd5a4419fbb3e27211b042ab1c;hp=0e58fecbb868bbe497add61ef1622dedb15b5e6a;hpb=61c96af09d3d2c917c69b17cc827e28a280db66c;p=gnulib.git diff --git a/tests/test-getopt_long.h b/tests/test-getopt_long.h index 0e58fecbb..07ea4a28f 100644 --- a/tests/test-getopt_long.h +++ b/tests/test-getopt_long.h @@ -1,5 +1,5 @@ /* Test of command line argument processing. - Copyright (C) 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2009-2014 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -314,6 +314,25 @@ test_getopt_long (void) } } + /* Test that 'W' does not dump core: + http://sourceware.org/bugzilla/show_bug.cgi?id=12922 */ + { + int argc = 0; + const char *argv[10]; + int option_index; + int c; + + argv[argc++] = "program"; + argv[argc++] = "-W"; + argv[argc++] = "dummy"; + argv[argc] = NULL; + optind = 1; + opterr = 0; + c = do_getopt_long (argc, argv, "W;", NULL, &option_index); + ASSERT (c == 'W'); + ASSERT (optind == 2); + } + /* Test processing of boolean short options. */ for (start = 0; start <= 1; start++) { @@ -1747,7 +1766,7 @@ test_getopt_long (void) ASSERT (q_value == NULL); ASSERT (non_options_count == 0); ASSERT (unrecognized == 0); - ASSERT (optind = 1); + ASSERT (optind == 1); } /* Check that the '+' flag has to come first. */