3 # Copyright (c) 2007 Johannes Schindelin
6 test_description
='our own option parser'
10 cat > expect.err
<< EOF
11 usage: test-parse-options <options>
13 -b, --boolean get a boolean
14 -i, --integer <n> get a integer
15 -j <n> get a integer, too
20 --string2 <str> get another string
24 test_expect_success
'test help' '
25 ! test-parse-options -h > output 2> output.err &&
27 git diff expect.err output.err
36 test_expect_success
'short options' '
37 test-parse-options -s123 -b -i 1729 -b > output 2> output.err &&
38 git diff expect output &&
47 test_expect_success
'long options' '
48 test-parse-options --boolean --integer 1729 --boolean --string2=321 \
49 > output 2> output.err &&
50 test ! -s output.err &&
51 git diff expect output
63 test_expect_success
'intermingled arguments' '
64 test-parse-options a1 --string 123 b1 --boolean -j 13 -- --boolean \
65 > output 2> output.err &&
66 test ! -s output.err &&
67 git diff expect output