@@ -7,7 +7,7 @@ test_description='our own option parser'
77
88. ./test-lib.sh
99
10- cat > expect << EOF
10+ cat > expect << \ EOF
1111usage: test-parse-options <options>
1212
1313 --yes get a boolean
@@ -49,14 +49,14 @@ Standard options
4949EOF
5050
5151test_expect_success ' test help' '
52- test_must_fail test-parse-options -h > output 2> output.err &&
52+ test_must_fail test-parse-options -h >output 2>output.err &&
5353 test_must_be_empty output.err &&
5454 test_i18ncmp expect output
5555'
5656
5757mv expect expect.err
5858
59- cat > expect.template << EOF
59+ cat > expect.template << \ EOF
6060boolean: 0
6161integer: 0
6262magnitude: 0
@@ -156,7 +156,7 @@ test_expect_success 'OPT_MAGNITUDE() 3giga' '
156156 check magnitude: 3221225472 -m 3g
157157'
158158
159- cat > expect << EOF
159+ cat > expect << \ EOF
160160boolean: 2
161161integer: 1729
162162magnitude: 16384
@@ -176,7 +176,7 @@ test_expect_success 'short options' '
176176 test_must_be_empty output.err
177177'
178178
179- cat > expect << EOF
179+ cat > expect << \ EOF
180180boolean: 2
181181integer: 1729
182182magnitude: 16384
@@ -204,7 +204,7 @@ test_expect_success 'missing required value' '
204204 test_expect_code 129 test-parse-options --file
205205'
206206
207- cat > expect << EOF
207+ cat > expect << \ EOF
208208boolean: 1
209209integer: 13
210210magnitude: 0
@@ -222,12 +222,12 @@ EOF
222222
223223test_expect_success ' intermingled arguments' '
224224 test-parse-options a1 --string 123 b1 --boolean -j 13 -- --boolean \
225- > output 2> output.err &&
225+ >output 2>output.err &&
226226 test_must_be_empty output.err &&
227227 test_cmp expect output
228228'
229229
230- cat > expect << EOF
230+ cat > expect << \ EOF
231231boolean: 0
232232integer: 2
233233magnitude: 0
@@ -241,13 +241,13 @@ file: (not set)
241241EOF
242242
243243test_expect_success ' unambiguously abbreviated option' '
244- test-parse-options --int 2 --boolean --no-bo > output 2> output.err &&
244+ test-parse-options --int 2 --boolean --no-bo >output 2>output.err &&
245245 test_must_be_empty output.err &&
246246 test_cmp expect output
247247'
248248
249249test_expect_success ' unambiguously abbreviated option with "="' '
250- test-parse-options --int=2 > output 2> output.err &&
250+ test-parse-options --int=2 >output 2>output.err &&
251251 test_must_be_empty output.err &&
252252 test_cmp expect output
253253'
@@ -256,7 +256,7 @@ test_expect_success 'ambiguously abbreviated option' '
256256 test_expect_code 129 test-parse-options --strin 123
257257'
258258
259- cat > expect << EOF
259+ cat > expect << \ EOF
260260boolean: 0
261261integer: 0
262262magnitude: 0
@@ -270,32 +270,32 @@ file: (not set)
270270EOF
271271
272272test_expect_success ' non ambiguous option (after two options it abbreviates)' '
273- test-parse-options --st 123 > output 2> output.err &&
273+ test-parse-options --st 123 >output 2>output.err &&
274274 test_must_be_empty output.err &&
275275 test_cmp expect output
276276'
277277
278- cat > typo.err << EOF
279- error: did you mean \ ` --boolean\ ` (with two dashes ?)
278+ cat > typo.err << \ EOF
279+ error: did you mean ` --boolean` (with two dashes ?)
280280EOF
281281
282282test_expect_success ' detect possible typos' '
283- test_must_fail test-parse-options -boolean > output 2> output.err &&
283+ test_must_fail test-parse-options -boolean >output 2>output.err &&
284284 test_must_be_empty output &&
285285 test_cmp typo.err output.err
286286'
287287
288- cat > typo.err << EOF
289- error: did you mean \ ` --ambiguous\ ` (with two dashes ?)
288+ cat > typo.err << \ EOF
289+ error: did you mean ` --ambiguous` (with two dashes ?)
290290EOF
291291
292292test_expect_success ' detect possible typos' '
293- test_must_fail test-parse-options -ambiguous > output 2> output.err &&
293+ test_must_fail test-parse-options -ambiguous >output 2>output.err &&
294294 test_must_be_empty output &&
295295 test_cmp typo.err output.err
296296'
297297
298- cat > expect << EOF
298+ cat > expect << \ EOF
299299boolean: 0
300300integer: 0
301301magnitude: 0
@@ -310,12 +310,12 @@ arg 00: --quux
310310EOF
311311
312312test_expect_success ' keep some options as arguments' '
313- test-parse-options --quux > output 2> output.err &&
313+ test-parse-options --quux >output 2>output.err &&
314314 test_must_be_empty output.err &&
315- test_cmp expect output
315+ test_cmp expect output
316316'
317317
318- cat > expect << EOF
318+ cat > expect << \ EOF
319319boolean: 0
320320integer: 0
321321magnitude: 0
@@ -331,12 +331,12 @@ EOF
331331
332332test_expect_success ' OPT_DATE() works' '
333333 test-parse-options -t "1970-01-01 00:00:01 +0000" \
334- foo -q > output 2> output.err &&
334+ foo -q >output 2>output.err &&
335335 test_must_be_empty output.err &&
336336 test_cmp expect output
337337'
338338
339- cat > expect << EOF
339+ cat > expect << \ EOF
340340Callback: "four", 0
341341boolean: 5
342342integer: 4
@@ -351,22 +351,22 @@ file: (not set)
351351EOF
352352
353353test_expect_success ' OPT_CALLBACK() and OPT_BIT() work' '
354- test-parse-options --length=four -b -4 > output 2> output.err &&
354+ test-parse-options --length=four -b -4 >output 2>output.err &&
355355 test_must_be_empty output.err &&
356356 test_cmp expect output
357357'
358358
359- cat > expect << EOF
359+ cat > expect << \ EOF
360360Callback: "not set", 1
361361EOF
362362
363363test_expect_success ' OPT_CALLBACK() and callback errors work' '
364- test_must_fail test-parse-options --no-length > output 2> output.err &&
364+ test_must_fail test-parse-options --no-length >output 2>output.err &&
365365 test_i18ncmp expect output &&
366366 test_i18ncmp expect.err output.err
367367'
368368
369- cat > expect << EOF
369+ cat > expect << \ EOF
370370boolean: 1
371371integer: 23
372372magnitude: 0
@@ -380,18 +380,18 @@ file: (not set)
380380EOF
381381
382382test_expect_success ' OPT_BIT() and OPT_SET_INT() work' '
383- test-parse-options --set23 -bbbbb --no-or4 > output 2> output.err &&
383+ test-parse-options --set23 -bbbbb --no-or4 >output 2>output.err &&
384384 test_must_be_empty output.err &&
385385 test_cmp expect output
386386'
387387
388388test_expect_success ' OPT_NEGBIT() and OPT_SET_INT() work' '
389- test-parse-options --set23 -bbbbb --neg-or4 > output 2> output.err &&
389+ test-parse-options --set23 -bbbbb --neg-or4 >output 2>output.err &&
390390 test_must_be_empty output.err &&
391391 test_cmp expect output
392392'
393393
394- cat > expect << EOF
394+ cat > expect << \ EOF
395395boolean: 6
396396integer: 0
397397magnitude: 0
@@ -405,24 +405,24 @@ file: (not set)
405405EOF
406406
407407test_expect_success ' OPT_BIT() works' '
408- test-parse-options -bb --or4 > output 2> output.err &&
408+ test-parse-options -bb --or4 >output 2>output.err &&
409409 test_must_be_empty output.err &&
410410 test_cmp expect output
411411'
412412
413413test_expect_success ' OPT_NEGBIT() works' '
414- test-parse-options -bb --no-neg-or4 > output 2> output.err &&
414+ test-parse-options -bb --no-neg-or4 >output 2>output.err &&
415415 test_must_be_empty output.err &&
416416 test_cmp expect output
417417'
418418
419419test_expect_success ' OPT_COUNTUP() with PARSE_OPT_NODASH works' '
420- test-parse-options + + + + + + > output 2> output.err &&
420+ test-parse-options + + + + + + >output 2>output.err &&
421421 test_must_be_empty output.err &&
422422 test_cmp expect output
423423'
424424
425- cat > expect << EOF
425+ cat > expect << \ EOF
426426boolean: 0
427427integer: 12345
428428magnitude: 0
@@ -436,12 +436,12 @@ file: (not set)
436436EOF
437437
438438test_expect_success ' OPT_NUMBER_CALLBACK() works' '
439- test-parse-options -12345 > output 2> output.err &&
439+ test-parse-options -12345 >output 2>output.err &&
440440 test_must_be_empty output.err &&
441441 test_cmp expect output
442442'
443443
444- cat > expect << EOF
444+ cat > expect << \ EOF
445445boolean: 0
446446integer: 0
447447magnitude: 0
@@ -460,7 +460,7 @@ test_expect_success 'negation of OPT_NONEG flags is not ambiguous' '
460460 test_cmp expect output
461461'
462462
463- cat >> expect << ' EOF '
463+ cat >> expect << \ EOF
464464list: foo
465465list: bar
466466list: baz
0 commit comments