|
58 | 58 | '
|
59 | 59 |
|
60 | 60 | test_expect_success 'test --parseopt help output' '
|
61 |
| - sed -e "s/^|//" >expect <<\END_EXPECT && |
62 |
| -|cat <<\EOF |
63 |
| -|usage: some-command [options] <args>... |
64 |
| -| |
65 |
| -| some-command does foo and bar! |
66 |
| -| |
67 |
| -| -h, --help show the help |
68 |
| -| --foo some nifty option --foo |
69 |
| -| --bar ... some cool option --bar with an argument |
70 |
| -| -b, --baz a short and long option |
71 |
| -| |
72 |
| -|An option group Header |
73 |
| -| -C[...] option C with an optional argument |
74 |
| -| -d, --data[=...] short and long option with an optional argument |
75 |
| -| |
76 |
| -|Argument hints |
77 |
| -| -B <arg> short option required argument |
78 |
| -| --bar2 <arg> long option required argument |
79 |
| -| -e, --fuz <with-space> |
80 |
| -| short and long option required argument |
81 |
| -| -s[<some>] short option optional argument |
82 |
| -| --long[=<data>] long option optional argument |
83 |
| -| -g, --fluf[=<path>] short and long option optional argument |
84 |
| -| --longest <very-long-argument-hint> |
85 |
| -| a very long argument hint |
86 |
| -| --pair <key=value> with an equals sign in the hint |
87 |
| -| --aswitch help te=t contains? fl*g characters!` |
88 |
| -| --bswitch <hint> hint has trailing tab character |
89 |
| -| --cswitch switch has trailing tab character |
90 |
| -| --short-hint <a> with a one symbol hint |
91 |
| -| |
92 |
| -|Extras |
93 |
| -| --extra1 line above used to cause a segfault but no longer does |
94 |
| -| |
95 |
| -|EOF |
96 |
| -END_EXPECT |
97 | 61 | test_expect_code 129 git rev-parse --parseopt -- -h > output < optionspec &&
|
98 |
| - test_cmp expect output |
| 62 | + test_cmp "$TEST_DIRECTORY/t1502/optionspec.help" output |
99 | 63 | '
|
100 | 64 |
|
101 | 65 | test_expect_success 'test --parseopt help output no switches' '
|
@@ -140,41 +104,12 @@ END_EXPECT
|
140 | 104 | '
|
141 | 105 |
|
142 | 106 | test_expect_success 'test --parseopt invalid switch help output' '
|
143 |
| - sed -e "s/^|//" >expect <<\END_EXPECT && |
144 |
| -|error: unknown option `does-not-exist'\'' |
145 |
| -|usage: some-command [options] <args>... |
146 |
| -| |
147 |
| -| some-command does foo and bar! |
148 |
| -| |
149 |
| -| -h, --help show the help |
150 |
| -| --foo some nifty option --foo |
151 |
| -| --bar ... some cool option --bar with an argument |
152 |
| -| -b, --baz a short and long option |
153 |
| -| |
154 |
| -|An option group Header |
155 |
| -| -C[...] option C with an optional argument |
156 |
| -| -d, --data[=...] short and long option with an optional argument |
157 |
| -| |
158 |
| -|Argument hints |
159 |
| -| -B <arg> short option required argument |
160 |
| -| --bar2 <arg> long option required argument |
161 |
| -| -e, --fuz <with-space> |
162 |
| -| short and long option required argument |
163 |
| -| -s[<some>] short option optional argument |
164 |
| -| --long[=<data>] long option optional argument |
165 |
| -| -g, --fluf[=<path>] short and long option optional argument |
166 |
| -| --longest <very-long-argument-hint> |
167 |
| -| a very long argument hint |
168 |
| -| --pair <key=value> with an equals sign in the hint |
169 |
| -| --aswitch help te=t contains? fl*g characters!` |
170 |
| -| --bswitch <hint> hint has trailing tab character |
171 |
| -| --cswitch switch has trailing tab character |
172 |
| -| --short-hint <a> with a one symbol hint |
173 |
| -| |
174 |
| -|Extras |
175 |
| -| --extra1 line above used to cause a segfault but no longer does |
176 |
| -| |
177 |
| -END_EXPECT |
| 107 | + { |
| 108 | + cat <<-\EOF && |
| 109 | + error: unknown option `does-not-exist'\'' |
| 110 | + EOF |
| 111 | + sed -e 1d -e \$d <"$TEST_DIRECTORY/t1502/optionspec.help" |
| 112 | + } >expect && |
178 | 113 | test_expect_code 129 git rev-parse --parseopt -- --does-not-exist 1>/dev/null 2>output < optionspec &&
|
179 | 114 | test_cmp expect output
|
180 | 115 | '
|
|
0 commit comments