@@ -208,32 +208,15 @@ test_expect_success 'unambiguously abbreviated option' '
208
208
'
209
209
210
210
test_expect_success ' unambiguously abbreviated option with "="' '
211
- test-parse-options --int=2 >output 2>output.err &&
212
- test_must_be_empty output.err &&
213
- test_cmp expect output
211
+ test-parse-options --expect="integer: 2" --int=2
214
212
'
215
213
216
214
test_expect_success ' ambiguously abbreviated option' '
217
215
test_expect_code 129 test-parse-options --strin 123
218
216
'
219
217
220
- cat > expect << \EOF
221
- boolean: 0
222
- integer: 0
223
- magnitude: 0
224
- timestamp: 0
225
- string: 123
226
- abbrev: 7
227
- verbose: -1
228
- quiet: 0
229
- dry run: no
230
- file: (not set)
231
- EOF
232
-
233
218
test_expect_success ' non ambiguous option (after two options it abbreviates)' '
234
- test-parse-options --st 123 >output 2>output.err &&
235
- test_must_be_empty output.err &&
236
- test_cmp expect output
219
+ test-parse-options --expect="string: 123" --st 123
237
220
'
238
221
239
222
cat > typo.err << \EOF
@@ -256,24 +239,8 @@ test_expect_success 'detect possible typos' '
256
239
test_cmp typo.err output.err
257
240
'
258
241
259
- cat > expect << \EOF
260
- boolean: 0
261
- integer: 0
262
- magnitude: 0
263
- timestamp: 0
264
- string: (not set)
265
- abbrev: 7
266
- verbose: -1
267
- quiet: 0
268
- dry run: no
269
- file: (not set)
270
- arg 00: --quux
271
- EOF
272
-
273
242
test_expect_success ' keep some options as arguments' '
274
- test-parse-options --quux >output 2>output.err &&
275
- test_must_be_empty output.err &&
276
- test_cmp expect output
243
+ test-parse-options --expect="arg 00: --quux" --quux
277
244
'
278
245
279
246
cat > expect << \EOF
@@ -350,54 +317,20 @@ test_expect_success 'OPT_NEGBIT() and OPT_SET_INT() work' '
350
317
test_cmp expect output
351
318
'
352
319
353
- cat > expect << \EOF
354
- boolean: 6
355
- integer: 0
356
- magnitude: 0
357
- timestamp: 0
358
- string: (not set)
359
- abbrev: 7
360
- verbose: -1
361
- quiet: 0
362
- dry run: no
363
- file: (not set)
364
- EOF
365
-
366
320
test_expect_success ' OPT_BIT() works' '
367
- test-parse-options -bb --or4 >output 2>output.err &&
368
- test_must_be_empty output.err &&
369
- test_cmp expect output
321
+ test-parse-options --expect="boolean: 6" -bb --or4
370
322
'
371
323
372
324
test_expect_success ' OPT_NEGBIT() works' '
373
- test-parse-options -bb --no-neg-or4 >output 2>output.err &&
374
- test_must_be_empty output.err &&
375
- test_cmp expect output
325
+ test-parse-options --expect="boolean: 6" -bb --no-neg-or4
376
326
'
377
327
378
328
test_expect_success ' OPT_COUNTUP() with PARSE_OPT_NODASH works' '
379
- test-parse-options + + + + + + >output 2>output.err &&
380
- test_must_be_empty output.err &&
381
- test_cmp expect output
329
+ test-parse-options --expect="boolean: 6" + + + + + +
382
330
'
383
331
384
- cat > expect << \EOF
385
- boolean: 0
386
- integer: 12345
387
- magnitude: 0
388
- timestamp: 0
389
- string: (not set)
390
- abbrev: 7
391
- verbose: -1
392
- quiet: 0
393
- dry run: no
394
- file: (not set)
395
- EOF
396
-
397
332
test_expect_success ' OPT_NUMBER_CALLBACK() works' '
398
- test-parse-options -12345 >output 2>output.err &&
399
- test_must_be_empty output.err &&
400
- test_cmp expect output
333
+ test-parse-options --expect="integer: 12345" -12345
401
334
'
402
335
403
336
cat > expect << \EOF
@@ -435,118 +368,28 @@ test_expect_success '--no-list resets list' '
435
368
test_cmp expect output
436
369
'
437
370
438
- cat > expect << \EOF
439
- boolean: 0
440
- integer: 0
441
- magnitude: 0
442
- timestamp: 0
443
- string: (not set)
444
- abbrev: 7
445
- verbose: -1
446
- quiet: 3
447
- dry run: no
448
- file: (not set)
449
- EOF
450
-
451
371
test_expect_success ' multiple quiet levels' '
452
- test-parse-options -q -q -q >output 2>output.err &&
453
- test_must_be_empty output.err &&
454
- test_cmp expect output
372
+ test-parse-options --expect="quiet: 3" -q -q -q
455
373
'
456
374
457
- cat > expect << \EOF
458
- boolean: 0
459
- integer: 0
460
- magnitude: 0
461
- timestamp: 0
462
- string: (not set)
463
- abbrev: 7
464
- verbose: 3
465
- quiet: 0
466
- dry run: no
467
- file: (not set)
468
- EOF
469
-
470
375
test_expect_success ' multiple verbose levels' '
471
- test-parse-options -v -v -v >output 2>output.err &&
472
- test_must_be_empty output.err &&
473
- test_cmp expect output
376
+ test-parse-options --expect="verbose: 3" -v -v -v
474
377
'
475
378
476
- cat > expect << \EOF
477
- boolean: 0
478
- integer: 0
479
- magnitude: 0
480
- timestamp: 0
481
- string: (not set)
482
- abbrev: 7
483
- verbose: -1
484
- quiet: 0
485
- dry run: no
486
- file: (not set)
487
- EOF
488
-
489
379
test_expect_success ' --no-quiet sets --quiet to 0' '
490
- test-parse-options --no-quiet >output 2>output.err &&
491
- test_must_be_empty output.err &&
492
- test_cmp expect output
380
+ test-parse-options --expect="quiet: 0" --no-quiet
493
381
'
494
382
495
- cat > expect << \EOF
496
- boolean: 0
497
- integer: 0
498
- magnitude: 0
499
- timestamp: 0
500
- string: (not set)
501
- abbrev: 7
502
- verbose: -1
503
- quiet: 0
504
- dry run: no
505
- file: (not set)
506
- EOF
507
-
508
383
test_expect_success ' --no-quiet resets multiple -q to 0' '
509
- test-parse-options -q -q -q --no-quiet >output 2>output.err &&
510
- test_must_be_empty output.err &&
511
- test_cmp expect output
384
+ test-parse-options --expect="quiet: 0" -q -q -q --no-quiet
512
385
'
513
386
514
- cat > expect << \EOF
515
- boolean: 0
516
- integer: 0
517
- magnitude: 0
518
- timestamp: 0
519
- string: (not set)
520
- abbrev: 7
521
- verbose: 0
522
- quiet: 0
523
- dry run: no
524
- file: (not set)
525
- EOF
526
-
527
387
test_expect_success ' --no-verbose sets verbose to 0' '
528
- test-parse-options --no-verbose >output 2>output.err &&
529
- test_must_be_empty output.err &&
530
- test_cmp expect output
388
+ test-parse-options --expect="verbose: 0" --no-verbose
531
389
'
532
390
533
- cat > expect << \EOF
534
- boolean: 0
535
- integer: 0
536
- magnitude: 0
537
- timestamp: 0
538
- string: (not set)
539
- abbrev: 7
540
- verbose: 0
541
- quiet: 0
542
- dry run: no
543
- file: (not set)
544
- EOF
545
-
546
391
test_expect_success ' --no-verbose resets multiple verbose to 0' '
547
- test-parse-options -v -v -v --no-verbose >output 2>output.err &&
548
- test_must_be_empty output.err &&
549
- test_cmp expect output
392
+ test-parse-options --expect="verbose: 0" -v -v -v --no-verbose
550
393
'
551
394
552
395
test_done
0 commit comments