diff options
author | René Scharfe <rene.scharfe@lsrfire.ath.cx> | 2009-05-07 21:45:08 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-05-09 00:29:47 -0700 |
commit | e0319ff5ed2b7927302389181449dcd029a26622 (patch) | |
tree | 5185c782d22d57ce359f0493bc26aa5ac5215c77 /t | |
parent | parseopt: add OPT_NEGBIT (diff) | |
download | tgif-e0319ff5ed2b7927302389181449dcd029a26622.tar.xz |
parseopt: add OPT_NUMBER_CALLBACK
Add a way to recognize numerical options. The number is passed to
a callback function as a string.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-x | t/t0040-parse-options.sh | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/t/t0040-parse-options.sh b/t/t0040-parse-options.sh index 9054ed6030..8ca62ef453 100755 --- a/t/t0040-parse-options.sh +++ b/t/t0040-parse-options.sh @@ -30,6 +30,7 @@ String options Magic arguments --quux means --quux + -NUM set integer to NUM Standard options --abbrev[=<n>] use <n> digits to display SHA-1s @@ -275,4 +276,21 @@ test_expect_success 'OPT_NEGBIT() works' ' test_cmp expect output ' +cat > expect <<EOF +boolean: 0 +integer: 12345 +timestamp: 0 +string: (not set) +abbrev: 7 +verbose: 0 +quiet: no +dry run: no +EOF + +test_expect_success 'OPT_NUMBER_CALLBACK() works' ' + test-parse-options -12345 > output 2> output.err && + test ! -s output.err && + test_cmp expect output +' + test_done |