summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorRené Scharfe <rene.scharfe@lsrfire.ath.cx>2009-05-07 19:45:08 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-05-09 07:29:47 (GMT)
commite0319ff5ed2b7927302389181449dcd029a26622 (patch)
tree5185c782d22d57ce359f0493bc26aa5ac5215c77 /t
parent2f4b97f91071f5060bf2da482cf8b0d70486d808 (diff)
downloadgit-e0319ff5ed2b7927302389181449dcd029a26622.zip
git-e0319ff5ed2b7927302389181449dcd029a26622.tar.gz
git-e0319ff5ed2b7927302389181449dcd029a26622.tar.bz2
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-xt/t0040-parse-options.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/t/t0040-parse-options.sh b/t/t0040-parse-options.sh
index 9054ed6..8ca62ef 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