File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020
2121EOF
2222
23- test_expect_success ' test --parseopt help output' '
24- git rev-parse --parseopt -- -h 2> output.err <<EOF
23+ cat > optionspec << EOF
2524some-command [options] <args>...
2625
2726some-command does foo and bar!
@@ -37,7 +36,42 @@ C? option C with an optional argument
3736Extras
3837extra1 line above used to cause a segfault but no longer does
3938EOF
39+
40+ test_expect_success ' test --parseopt help output' '
41+ git rev-parse --parseopt -- -h 2> output.err < optionspec
4042 test_cmp expect.err output.err
4143'
4244
45+ cat > expect << EOF
46+ set -- --foo --bar 'ham' -- 'arg'
47+ EOF
48+
49+ test_expect_success ' test --parseopt' '
50+ git rev-parse --parseopt -- --foo --bar=ham arg < optionspec > output &&
51+ test_cmp expect output
52+ '
53+
54+ test_expect_success ' test --parseopt with mixed options and arguments' '
55+ git rev-parse --parseopt -- --foo arg --bar=ham < optionspec > output &&
56+ test_cmp expect output
57+ '
58+
59+ cat > expect << EOF
60+ set -- --foo -- 'arg' '--bar=ham'
61+ EOF
62+
63+ test_expect_success ' test --parseopt with --' '
64+ git rev-parse --parseopt -- --foo -- arg --bar=ham < optionspec > output &&
65+ test_cmp expect output
66+ '
67+
68+ cat > expect << EOF
69+ set -- --foo -- '--' 'arg' '--bar=ham'
70+ EOF
71+
72+ test_expect_success ' test --parseopt --keep-dashdash' '
73+ git rev-parse --parseopt --keep-dashdash -- --foo -- arg --bar=ham < optionspec > output &&
74+ test_cmp expect output
75+ '
76+
4377test_done
You can’t perform that action at this time.
0 commit comments