summaryrefslogtreecommitdiff
path: root/t/t1502-rev-parse-parseopt.sh
blob: 762af5faf75562cd2a24197eae56357b1443737d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh

test_description='test git rev-parse --parseopt'
. ./test-lib.sh

cat > expect.err <<EOF
usage: some-command [options] <args>...
    
    some-command does foo and bar!

    -h, --help            show the help
    --foo                 some nifty option --foo
    --bar ...             some cool option --bar with an argument

An option group Header
    -C [...]              option C with an optional argument

Extras
    --extra1              line above used to cause a segfault but no longer does

EOF

test_expect_success 'test --parseopt help output' '
	git rev-parse --parseopt -- -h 2> output.err <<EOF
some-command [options] <args>...

some-command does foo and bar!
--
h,help    show the help

foo       some nifty option --foo
bar=      some cool option --bar with an argument

 An option group Header
C?        option C with an optional argument

Extras
extra1    line above used to cause a segfault but no longer does
EOF
	git diff expect.err output.err
'

test_done