aboutsummaryrefslogtreecommitdiff
path: root/test-parse-options.c
diff options
context:
space:
mode:
authorRené Scharfe <rene.scharfe@lsrfire.ath.cx>2012-02-25 20:11:16 +0100
committerJunio C Hamano <gitster@pobox.com>2012-02-26 15:18:41 -0800
commitb9e63ddddc8928f39db6658bf6428a9b646e5ea5 (patch)
tree7c56288d45dad5a37aebf40df7dec593d02ee452 /test-parse-options.c
parentaf543833d4e10163af8045859cc081969fa5fcec (diff)
downloadgit-b9e63ddddc8928f39db6658bf6428a9b646e5ea5.tar.gz
git-b9e63ddddc8928f39db6658bf6428a9b646e5ea5.tar.xz
test-parse-options: convert to OPT_BOOL()
Introduce OPT_BOOL() to test-parse-options and add some tests for these "true" boolean options. Rename OPT_BOOLEAN to OPT_COUNTUP and OPTION_BOOLEAN to OPTION_COUNTUP as well. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'test-parse-options.c')
-rw-r--r--test-parse-options.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/test-parse-options.c b/test-parse-options.c
index 36487c402..3c9510a70 100644
--- a/test-parse-options.c
+++ b/test-parse-options.c
@@ -37,7 +37,11 @@ int main(int argc, const char **argv)
NULL
};
struct option options[] = {
- OPT_BOOLEAN('b', "boolean", &boolean, "get a boolean"),
+ OPT_BOOL(0, "yes", &boolean, "get a boolean"),
+ OPT_BOOL('D', "no-doubt", &boolean, "begins with 'no-'"),
+ { OPTION_SET_INT, 'B', "no-fear", &boolean, NULL,
+ "be brave", PARSE_OPT_NOARG | PARSE_OPT_NONEG, NULL, 1 },
+ OPT_COUNTUP('b', "boolean", &boolean, "increment by one"),
OPT_BIT('4', "or4", &boolean,
"bitwise-or boolean with ...0100", 4),
OPT_NEGBIT(0, "neg-or4", &boolean, "same as --no-or4", 4),
@@ -62,11 +66,11 @@ int main(int argc, const char **argv)
OPT_ARGUMENT("quux", "means --quux"),
OPT_NUMBER_CALLBACK(&integer, "set integer to NUM",
number_callback),
- { OPTION_BOOLEAN, '+', NULL, &boolean, NULL, "same as -b",
+ { OPTION_COUNTUP, '+', NULL, &boolean, NULL, "same as -b",
PARSE_OPT_NOARG | PARSE_OPT_NONEG | PARSE_OPT_NODASH },
- { OPTION_BOOLEAN, 0, "ambiguous", &ambiguous, NULL,
+ { OPTION_COUNTUP, 0, "ambiguous", &ambiguous, NULL,
"positive ambiguity", PARSE_OPT_NOARG | PARSE_OPT_NONEG },
- { OPTION_BOOLEAN, 0, "no-ambiguous", &ambiguous, NULL,
+ { OPTION_COUNTUP, 0, "no-ambiguous", &ambiguous, NULL,
"negative ambiguity", PARSE_OPT_NOARG | PARSE_OPT_NONEG },
OPT_GROUP("Standard options"),
OPT__ABBREV(&abbrev),