提交 81a48cc0 编写于 作者: C Charles Bailey 提交者: Junio C Hamano

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: NCharles Bailey <cbailey32@bloomberg.net>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 5c040f5a
......@@ -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
......
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册