t / t1502-rev-parse-parseopt.shon commit Git.pm: fix return value of config method (32d8050)
   1#!/bin/sh
   2
   3test_description='test git rev-parse --parseopt'
   4. ./test-lib.sh
   5
   6cat > expect.err <<EOF
   7usage: some-command [options] <args>...
   8    
   9    some-command does foo and bar!
  10
  11    -h, --help            show the help
  12    --foo                 some nifty option --foo
  13    --bar ...             some cool option --bar with an argument
  14
  15An option group Header
  16    -C [...]              option C with an optional argument
  17
  18Extras
  19    --extra1              line above used to cause a segfault but no longer does
  20
  21EOF
  22
  23test_expect_success 'test --parseopt help output' '
  24        git rev-parse --parseopt -- -h 2> output.err <<EOF
  25some-command [options] <args>...
  26
  27some-command does foo and bar!
  28--
  29h,help    show the help
  30
  31foo       some nifty option --foo
  32bar=      some cool option --bar with an argument
  33
  34 An option group Header
  35C?        option C with an optional argument
  36
  37Extras
  38extra1    line above used to cause a segfault but no longer does
  39EOF
  40        test_cmp expect.err output.err
  41'
  42
  43test_done