File tree Expand file tree Collapse file tree 1 file changed +36
-2
lines changed Expand file tree Collapse file tree 1 file changed +36
-2
lines changed Original file line number Diff line number Diff line change 20
20
21
21
EOF
22
22
23
- test_expect_success ' test --parseopt help output' '
24
- git rev-parse --parseopt -- -h 2> output.err <<EOF
23
+ cat > optionspec << EOF
25
24
some-command [options] <args>...
26
25
27
26
some-command does foo and bar!
@@ -37,7 +36,42 @@ C? option C with an optional argument
37
36
Extras
38
37
extra1 line above used to cause a segfault but no longer does
39
38
EOF
39
+
40
+ test_expect_success ' test --parseopt help output' '
41
+ git rev-parse --parseopt -- -h 2> output.err < optionspec
40
42
test_cmp expect.err output.err
41
43
'
42
44
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
+
43
77
test_done
You can’t perform that action at this time.
0 commit comments