1#!/bin/sh
23
test_description='test git rev-parse --parseopt'
4. ./test-lib.sh
56
cat > expect.err <<EOF
7usage: some-command [options] <args>...
89
some-command does foo and bar!
1011
-h, --help show the help
12--foo some nifty option --foo
13--bar ... some cool option --bar with an argument
1415
An option group Header
16-C[...] option C with an optional argument
1718
Extras
19--extra1 line above used to cause a segfault but no longer does
2021
EOF
2223
test_expect_success 'test --parseopt help output' '
24git rev-parse --parseopt -- -h 2> output.err <<EOF
25some-command [options] <args>...
2627
some-command does foo and bar!
28--
29h,help show the help
3031
foo some nifty option --foo
32bar= some cool option --bar with an argument
3334
An option group Header
35C? option C with an optional argument
3637
Extras
38extra1 line above used to cause a segfault but no longer does
39EOF
40test_cmp expect.err output.err
41'
4243
test_done