@@ -7,7 +7,7 @@ test_description='our own option parser'
7
7
8
8
. ./test-lib.sh
9
9
10
- cat > expect << EOF
10
+ cat > expect << \ EOF
11
11
usage: test-parse-options <options>
12
12
13
13
--yes get a boolean
@@ -49,14 +49,14 @@ Standard options
49
49
EOF
50
50
51
51
test_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 &&
53
53
test_must_be_empty output.err &&
54
54
test_i18ncmp expect output
55
55
'
56
56
57
57
mv expect expect.err
58
58
59
- cat > expect.template << EOF
59
+ cat > expect.template << \ EOF
60
60
boolean: 0
61
61
integer: 0
62
62
magnitude: 0
@@ -156,7 +156,7 @@ test_expect_success 'OPT_MAGNITUDE() 3giga' '
156
156
check magnitude: 3221225472 -m 3g
157
157
'
158
158
159
- cat > expect << EOF
159
+ cat > expect << \ EOF
160
160
boolean: 2
161
161
integer: 1729
162
162
magnitude: 16384
@@ -176,7 +176,7 @@ test_expect_success 'short options' '
176
176
test_must_be_empty output.err
177
177
'
178
178
179
- cat > expect << EOF
179
+ cat > expect << \ EOF
180
180
boolean: 2
181
181
integer: 1729
182
182
magnitude: 16384
@@ -204,7 +204,7 @@ test_expect_success 'missing required value' '
204
204
test_expect_code 129 test-parse-options --file
205
205
'
206
206
207
- cat > expect << EOF
207
+ cat > expect << \ EOF
208
208
boolean: 1
209
209
integer: 13
210
210
magnitude: 0
@@ -222,12 +222,12 @@ EOF
222
222
223
223
test_expect_success ' intermingled arguments' '
224
224
test-parse-options a1 --string 123 b1 --boolean -j 13 -- --boolean \
225
- > output 2> output.err &&
225
+ >output 2>output.err &&
226
226
test_must_be_empty output.err &&
227
227
test_cmp expect output
228
228
'
229
229
230
- cat > expect << EOF
230
+ cat > expect << \ EOF
231
231
boolean: 0
232
232
integer: 2
233
233
magnitude: 0
@@ -241,13 +241,13 @@ file: (not set)
241
241
EOF
242
242
243
243
test_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 &&
245
245
test_must_be_empty output.err &&
246
246
test_cmp expect output
247
247
'
248
248
249
249
test_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 &&
251
251
test_must_be_empty output.err &&
252
252
test_cmp expect output
253
253
'
@@ -256,7 +256,7 @@ test_expect_success 'ambiguously abbreviated option' '
256
256
test_expect_code 129 test-parse-options --strin 123
257
257
'
258
258
259
- cat > expect << EOF
259
+ cat > expect << \ EOF
260
260
boolean: 0
261
261
integer: 0
262
262
magnitude: 0
@@ -270,32 +270,32 @@ file: (not set)
270
270
EOF
271
271
272
272
test_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 &&
274
274
test_must_be_empty output.err &&
275
275
test_cmp expect output
276
276
'
277
277
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 ?)
280
280
EOF
281
281
282
282
test_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 &&
284
284
test_must_be_empty output &&
285
285
test_cmp typo.err output.err
286
286
'
287
287
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 ?)
290
290
EOF
291
291
292
292
test_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 &&
294
294
test_must_be_empty output &&
295
295
test_cmp typo.err output.err
296
296
'
297
297
298
- cat > expect << EOF
298
+ cat > expect << \ EOF
299
299
boolean: 0
300
300
integer: 0
301
301
magnitude: 0
@@ -310,12 +310,12 @@ arg 00: --quux
310
310
EOF
311
311
312
312
test_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 &&
314
314
test_must_be_empty output.err &&
315
- test_cmp expect output
315
+ test_cmp expect output
316
316
'
317
317
318
- cat > expect << EOF
318
+ cat > expect << \ EOF
319
319
boolean: 0
320
320
integer: 0
321
321
magnitude: 0
@@ -331,12 +331,12 @@ EOF
331
331
332
332
test_expect_success ' OPT_DATE() works' '
333
333
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 &&
335
335
test_must_be_empty output.err &&
336
336
test_cmp expect output
337
337
'
338
338
339
- cat > expect << EOF
339
+ cat > expect << \ EOF
340
340
Callback: "four", 0
341
341
boolean: 5
342
342
integer: 4
@@ -351,22 +351,22 @@ file: (not set)
351
351
EOF
352
352
353
353
test_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 &&
355
355
test_must_be_empty output.err &&
356
356
test_cmp expect output
357
357
'
358
358
359
- cat > expect << EOF
359
+ cat > expect << \ EOF
360
360
Callback: "not set", 1
361
361
EOF
362
362
363
363
test_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 &&
365
365
test_i18ncmp expect output &&
366
366
test_i18ncmp expect.err output.err
367
367
'
368
368
369
- cat > expect << EOF
369
+ cat > expect << \ EOF
370
370
boolean: 1
371
371
integer: 23
372
372
magnitude: 0
@@ -380,18 +380,18 @@ file: (not set)
380
380
EOF
381
381
382
382
test_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 &&
384
384
test_must_be_empty output.err &&
385
385
test_cmp expect output
386
386
'
387
387
388
388
test_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 &&
390
390
test_must_be_empty output.err &&
391
391
test_cmp expect output
392
392
'
393
393
394
- cat > expect << EOF
394
+ cat > expect << \ EOF
395
395
boolean: 6
396
396
integer: 0
397
397
magnitude: 0
@@ -405,24 +405,24 @@ file: (not set)
405
405
EOF
406
406
407
407
test_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 &&
409
409
test_must_be_empty output.err &&
410
410
test_cmp expect output
411
411
'
412
412
413
413
test_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 &&
415
415
test_must_be_empty output.err &&
416
416
test_cmp expect output
417
417
'
418
418
419
419
test_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 &&
421
421
test_must_be_empty output.err &&
422
422
test_cmp expect output
423
423
'
424
424
425
- cat > expect << EOF
425
+ cat > expect << \ EOF
426
426
boolean: 0
427
427
integer: 12345
428
428
magnitude: 0
@@ -436,12 +436,12 @@ file: (not set)
436
436
EOF
437
437
438
438
test_expect_success ' OPT_NUMBER_CALLBACK() works' '
439
- test-parse-options -12345 > output 2> output.err &&
439
+ test-parse-options -12345 >output 2>output.err &&
440
440
test_must_be_empty output.err &&
441
441
test_cmp expect output
442
442
'
443
443
444
- cat > expect << EOF
444
+ cat > expect << \ EOF
445
445
boolean: 0
446
446
integer: 0
447
447
magnitude: 0
@@ -460,7 +460,7 @@ test_expect_success 'negation of OPT_NONEG flags is not ambiguous' '
460
460
test_cmp expect output
461
461
'
462
462
463
- cat >> expect << ' EOF '
463
+ cat >> expect << \ EOF
464
464
list: foo
465
465
list: bar
466
466
list: baz
0 commit comments