diff options
author | Charles Bailey <cbailey32@bloomberg.net> | 2015-06-21 19:25:43 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-06-22 15:04:23 -0700 |
commit | 81a48cc08033a453bcb884ec0838a8f064a6611e (patch) | |
tree | 424f6e59d7aa6832b63a04d8eea65630cca4b1f7 | |
parent | 5c040f5af5898ce841cabdcda7bbdc38483123ef (diff) | |
download | git-81a48cc08033a453bcb884ec0838a8f064a6611e.tar.gz git-81a48cc08033a453bcb884ec0838a8f064a6611e.tar.xz |
test-parse-options: update to handle negative ints
Fix the printf specification to treat 'integer' as the signed type
that it is and add a test that checks that we parse negative option
arguments.
Signed-off-by: Charles Bailey <cbailey32@bloomberg.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-x | t/t0040-parse-options.sh | 2 | ||||
-rw-r--r-- | test-parse-options.c | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/t/t0040-parse-options.sh b/t/t0040-parse-options.sh index b04478517..372d521c2 100755 --- a/t/t0040-parse-options.sh +++ b/t/t0040-parse-options.sh @@ -132,6 +132,8 @@ test_expect_success 'OPT_BOOL() no negation #2' 'check_unknown_i18n --no-no-fear test_expect_success 'OPT_BOOL() positivation' 'check boolean: 0 -D --doubt' +test_expect_success 'OPT_INT() negative' 'check integer: -2345 -i -2345' + cat > expect << EOF boolean: 2 integer: 1729 diff --git a/test-parse-options.c b/test-parse-options.c index 5dabce60f..7c492cf72 100644 --- a/test-parse-options.c +++ b/test-parse-options.c @@ -82,7 +82,7 @@ int main(int argc, char **argv) argc = parse_options(argc, (const char **)argv, prefix, options, usage, 0); printf("boolean: %d\n", boolean); - printf("integer: %u\n", integer); + printf("integer: %d\n", integer); printf("timestamp: %lu\n", timestamp); printf("string: %s\n", string ? string : "(not set)"); printf("abbrev: %d\n", abbrev); |