@@ -8,7 +8,7 @@ test_description='our own option parser'
88. ./test-lib.sh
99
1010cat > expect << \EOF
11- usage: test-parse-options <options>
11+ usage: test-tool parse-options <options>
1212
1313 A helper function for the parse-options API.
1414
@@ -52,7 +52,7 @@ Standard options
5252EOF
5353
5454test_expect_success ' test help' '
55- test_must_fail test-parse-options -h >output 2>output.err &&
55+ test_must_fail test-tool parse-options -h >output 2>output.err &&
5656 test_must_be_empty output.err &&
5757 test_i18ncmp expect output
5858'
@@ -64,7 +64,7 @@ check () {
6464 shift &&
6565 expect=" $1 " &&
6666 shift &&
67- test-parse-options --expect=" $what $expect " " $@ "
67+ test-tool parse-options --expect=" $what $expect " " $@ "
6868}
6969
7070check_unknown_i18n () {
@@ -75,7 +75,7 @@ check_unknown_i18n() {
7575 echo error: unknown switch \` ${1# -} \' > expect ;;
7676 esac &&
7777 cat expect.err >> expect &&
78- test_must_fail test-parse-options $* > output 2> output.err &&
78+ test_must_fail test-tool parse-options $* > output 2> output.err &&
7979 test_must_be_empty output &&
8080 test_i18ncmp expect output.err
8181}
@@ -133,7 +133,7 @@ file: prefix/my.file
133133EOF
134134
135135test_expect_success ' short options' '
136- test-parse-options -s123 -b -i 1729 -m 16k -b -vv -n -F my.file \
136+ test-tool parse-options -s123 -b -i 1729 -m 16k -b -vv -n -F my.file \
137137 >output 2>output.err &&
138138 test_cmp expect output &&
139139 test_must_be_empty output.err
@@ -153,7 +153,7 @@ file: prefix/fi.le
153153EOF
154154
155155test_expect_success ' long options' '
156- test-parse-options --boolean --integer 1729 --magnitude 16k \
156+ test-tool parse-options --boolean --integer 1729 --magnitude 16k \
157157 --boolean --string2=321 --verbose --verbose --no-dry-run \
158158 --abbrev=10 --file fi.le --obsolete \
159159 >output 2>output.err &&
@@ -162,9 +162,9 @@ test_expect_success 'long options' '
162162'
163163
164164test_expect_success ' missing required value' '
165- test_expect_code 129 test-parse-options -s &&
166- test_expect_code 129 test-parse-options --string &&
167- test_expect_code 129 test-parse-options --file
165+ test_expect_code 129 test-tool parse-options -s &&
166+ test_expect_code 129 test-tool parse-options --string &&
167+ test_expect_code 129 test-tool parse-options --file
168168'
169169
170170cat > expect << \EOF
@@ -184,7 +184,7 @@ arg 02: --boolean
184184EOF
185185
186186test_expect_success ' intermingled arguments' '
187- test-parse-options a1 --string 123 b1 --boolean -j 13 -- --boolean \
187+ test-tool parse-options a1 --string 123 b1 --boolean -j 13 -- --boolean \
188188 >output 2>output.err &&
189189 test_must_be_empty output.err &&
190190 test_cmp expect output
@@ -204,29 +204,29 @@ file: (not set)
204204EOF
205205
206206test_expect_success ' unambiguously abbreviated option' '
207- test-parse-options --int 2 --boolean --no-bo >output 2>output.err &&
207+ test-tool parse-options --int 2 --boolean --no-bo >output 2>output.err &&
208208 test_must_be_empty output.err &&
209209 test_cmp expect output
210210'
211211
212212test_expect_success ' unambiguously abbreviated option with "="' '
213- test-parse-options --expect="integer: 2" --int=2
213+ test-tool parse-options --expect="integer: 2" --int=2
214214'
215215
216216test_expect_success ' ambiguously abbreviated option' '
217- test_expect_code 129 test-parse-options --strin 123
217+ test_expect_code 129 test-tool parse-options --strin 123
218218'
219219
220220test_expect_success ' non ambiguous option (after two options it abbreviates)' '
221- test-parse-options --expect="string: 123" --st 123
221+ test-tool parse-options --expect="string: 123" --st 123
222222'
223223
224224cat > typo.err << \EOF
225225error: did you mean ` --boolean` (with two dashes ?)
226226EOF
227227
228228test_expect_success ' detect possible typos' '
229- test_must_fail test-parse-options -boolean >output 2>output.err &&
229+ test_must_fail test-tool parse-options -boolean >output 2>output.err &&
230230 test_must_be_empty output &&
231231 test_cmp typo.err output.err
232232'
@@ -236,13 +236,13 @@ error: did you mean `--ambiguous` (with two dashes ?)
236236EOF
237237
238238test_expect_success ' detect possible typos' '
239- test_must_fail test-parse-options -ambiguous >output 2>output.err &&
239+ test_must_fail test-tool parse-options -ambiguous >output 2>output.err &&
240240 test_must_be_empty output &&
241241 test_cmp typo.err output.err
242242'
243243
244244test_expect_success ' keep some options as arguments' '
245- test-parse-options --expect="arg 00: --quux" --quux
245+ test-tool parse-options --expect="arg 00: --quux" --quux
246246'
247247
248248cat > expect << \EOF
@@ -260,7 +260,7 @@ arg 00: foo
260260EOF
261261
262262test_expect_success ' OPT_DATE() works' '
263- test-parse-options -t "1970-01-01 00:00:01 +0000" \
263+ test-tool parse-options -t "1970-01-01 00:00:01 +0000" \
264264 foo -q >output 2>output.err &&
265265 test_must_be_empty output.err &&
266266 test_cmp expect output
@@ -281,13 +281,13 @@ file: (not set)
281281EOF
282282
283283test_expect_success ' OPT_CALLBACK() and OPT_BIT() work' '
284- test-parse-options --length=four -b -4 >output 2>output.err &&
284+ test-tool parse-options --length=four -b -4 >output 2>output.err &&
285285 test_must_be_empty output.err &&
286286 test_cmp expect output
287287'
288288
289289test_expect_success ' OPT_CALLBACK() and callback errors work' '
290- test_must_fail test-parse-options --no-length >output 2>output.err &&
290+ test_must_fail test-tool parse-options --no-length >output 2>output.err &&
291291 test_must_be_empty output &&
292292 test_must_be_empty output.err
293293'
@@ -306,31 +306,31 @@ file: (not set)
306306EOF
307307
308308test_expect_success ' OPT_BIT() and OPT_SET_INT() work' '
309- test-parse-options --set23 -bbbbb --no-or4 >output 2>output.err &&
309+ test-tool parse-options --set23 -bbbbb --no-or4 >output 2>output.err &&
310310 test_must_be_empty output.err &&
311311 test_cmp expect output
312312'
313313
314314test_expect_success ' OPT_NEGBIT() and OPT_SET_INT() work' '
315- test-parse-options --set23 -bbbbb --neg-or4 >output 2>output.err &&
315+ test-tool parse-options --set23 -bbbbb --neg-or4 >output 2>output.err &&
316316 test_must_be_empty output.err &&
317317 test_cmp expect output
318318'
319319
320320test_expect_success ' OPT_BIT() works' '
321- test-parse-options --expect="boolean: 6" -bb --or4
321+ test-tool parse-options --expect="boolean: 6" -bb --or4
322322'
323323
324324test_expect_success ' OPT_NEGBIT() works' '
325- test-parse-options --expect="boolean: 6" -bb --no-neg-or4
325+ test-tool parse-options --expect="boolean: 6" -bb --no-neg-or4
326326'
327327
328328test_expect_success ' OPT_COUNTUP() with PARSE_OPT_NODASH works' '
329- test-parse-options --expect="boolean: 6" + + + + + +
329+ test-tool parse-options --expect="boolean: 6" + + + + + +
330330'
331331
332332test_expect_success ' OPT_NUMBER_CALLBACK() works' '
333- test-parse-options --expect="integer: 12345" -12345
333+ test-tool parse-options --expect="integer: 12345" -12345
334334'
335335
336336cat > expect << \EOF
@@ -347,7 +347,7 @@ file: (not set)
347347EOF
348348
349349test_expect_success ' negation of OPT_NONEG flags is not ambiguous' '
350- test-parse-options --no-ambig >output 2>output.err &&
350+ test-tool parse-options --no-ambig >output 2>output.err &&
351351 test_must_be_empty output.err &&
352352 test_cmp expect output
353353'
@@ -358,38 +358,38 @@ list: bar
358358list: baz
359359EOF
360360test_expect_success ' --list keeps list of strings' '
361- test-parse-options --list foo --list=bar --list=baz >output &&
361+ test-tool parse-options --list foo --list=bar --list=baz >output &&
362362 test_cmp expect output
363363'
364364
365365test_expect_success ' --no-list resets list' '
366- test-parse-options --list=other --list=irrelevant --list=options \
366+ test-tool parse-options --list=other --list=irrelevant --list=options \
367367 --no-list --list=foo --list=bar --list=baz >output &&
368368 test_cmp expect output
369369'
370370
371371test_expect_success ' multiple quiet levels' '
372- test-parse-options --expect="quiet: 3" -q -q -q
372+ test-tool parse-options --expect="quiet: 3" -q -q -q
373373'
374374
375375test_expect_success ' multiple verbose levels' '
376- test-parse-options --expect="verbose: 3" -v -v -v
376+ test-tool parse-options --expect="verbose: 3" -v -v -v
377377'
378378
379379test_expect_success ' --no-quiet sets --quiet to 0' '
380- test-parse-options --expect="quiet: 0" --no-quiet
380+ test-tool parse-options --expect="quiet: 0" --no-quiet
381381'
382382
383383test_expect_success ' --no-quiet resets multiple -q to 0' '
384- test-parse-options --expect="quiet: 0" -q -q -q --no-quiet
384+ test-tool parse-options --expect="quiet: 0" -q -q -q --no-quiet
385385'
386386
387387test_expect_success ' --no-verbose sets verbose to 0' '
388- test-parse-options --expect="verbose: 0" --no-verbose
388+ test-tool parse-options --expect="verbose: 0" --no-verbose
389389'
390390
391391test_expect_success ' --no-verbose resets multiple verbose to 0' '
392- test-parse-options --expect="verbose: 0" -v -v -v --no-verbose
392+ test-tool parse-options --expect="verbose: 0" -v -v -v --no-verbose
393393'
394394
395395test_done
0 commit comments