@@ -34,7 +34,7 @@ source "${BATS_LIB}/batslib/output.bash"
34
34
# STDIN - [opt = $@] message to display
35
35
# Outputs:
36
36
# STDERR - error message
37
- flunk () {
37
+ fail () {
38
38
(( $# == 0 )) && batslib_err || batslib_err " $@ "
39
39
return 1
40
40
}
@@ -68,7 +68,7 @@ assert() {
68
68
batslib_print_kv_single " $width " " ${single[@]} "
69
69
batslib_print_kv_single_or_multi " $width " " ${may_be_multi[@]} "
70
70
} | batslib_decorate ' assertion failed' \
71
- | flunk
71
+ | fail
72
72
fi
73
73
}
74
74
@@ -92,7 +92,7 @@ assert_equal() {
92
92
' expected' " $1 " \
93
93
' actual' " $2 " \
94
94
| batslib_decorate ' values do not equal' \
95
- | flunk
95
+ | fail
96
96
fi
97
97
}
98
98
@@ -159,14 +159,14 @@ assert_output() {
159
159
if (( is_match_line )) && (( is_match_contained )) ; then
160
160
echo " \` -l' and \` -l <index>' are mutually exclusive" \
161
161
| batslib_decorate ' ERROR: assert_output' \
162
- | flunk
162
+ | fail
163
163
return $?
164
164
fi
165
165
166
166
if (( is_mode_partial )) && (( is_mode_regex )) ; then
167
167
echo " \` -p' and \` -r' are mutually exclusive" \
168
168
| batslib_decorate ' ERROR: assert_output' \
169
- | flunk
169
+ | fail
170
170
return $?
171
171
fi
172
172
@@ -176,7 +176,7 @@ assert_output() {
176
176
if (( is_mode_regex == 1 )) && [[ ' ' =~ $expected ]] || (( $? == 2 )) ; then
177
177
echo " Invalid extended regular expression: \` $expected '" \
178
178
| batslib_decorate ' ERROR: assert_output' \
179
- | flunk
179
+ | fail
180
180
return $?
181
181
fi
182
182
@@ -199,7 +199,7 @@ assert_output() {
199
199
batslib_print_kv_single " $width " " ${single[@]} "
200
200
batslib_print_kv_single_or_multi " $width " " ${may_be_multi[@]} "
201
201
} | batslib_decorate ' no output line matches regular expression' \
202
- | flunk
202
+ | fail
203
203
elif (( is_mode_partial )) ; then
204
204
local -i idx
205
205
for (( idx = 0 ; idx < ${# lines[@]} ; ++ idx )) ; do
@@ -216,7 +216,7 @@ assert_output() {
216
216
batslib_print_kv_single " $width " " ${single[@]} "
217
217
batslib_print_kv_single_or_multi " $width " " ${may_be_multi[@]} "
218
218
} | batslib_decorate ' no output line contains substring' \
219
- | flunk
219
+ | fail
220
220
else
221
221
local -i idx
222
222
for (( idx = 0 ; idx < ${# lines[@]} ; ++ idx )) ; do
@@ -233,7 +233,7 @@ assert_output() {
233
233
batslib_print_kv_single " $width " " ${single[@]} "
234
234
batslib_print_kv_single_or_multi " $width " " ${may_be_multi[@]} "
235
235
} | batslib_decorate ' output does not contain line' \
236
- | flunk
236
+ | fail
237
237
fi
238
238
elif (( is_match_line )) ; then
239
239
# Specific line.
@@ -244,7 +244,7 @@ assert_output() {
244
244
' regex' " $expected " \
245
245
' line' " ${lines[$idx]} " \
246
246
| batslib_decorate ' regular expression does not match line' \
247
- | flunk
247
+ | fail
248
248
fi
249
249
elif (( is_mode_partial )) ; then
250
250
if [[ ${lines[$idx]} != * " $expected " * ]]; then
@@ -253,7 +253,7 @@ assert_output() {
253
253
' substring' " $expected " \
254
254
' line' " ${lines[$idx]} " \
255
255
| batslib_decorate ' line does not contain substring' \
256
- | flunk
256
+ | fail
257
257
fi
258
258
else
259
259
if [[ ${lines[$idx]} != " $expected " ]]; then
@@ -262,7 +262,7 @@ assert_output() {
262
262
' expected' " $expected " \
263
263
' actual' " ${lines[$idx]} " \
264
264
| batslib_decorate ' line differs' \
265
- | flunk
265
+ | fail
266
266
fi
267
267
fi
268
268
else
@@ -273,23 +273,23 @@ assert_output() {
273
273
' regex' " $expected " \
274
274
' output' " $output " \
275
275
| batslib_decorate ' regular expression does not match output' \
276
- | flunk
276
+ | fail
277
277
fi
278
278
elif (( is_mode_partial )) ; then
279
279
if [[ $output != * " $expected " * ]]; then
280
280
batslib_print_kv_single_or_multi 9 \
281
281
' substring' " $expected " \
282
282
' output' " $output " \
283
283
| batslib_decorate ' output does not contain substring' \
284
- | flunk
284
+ | fail
285
285
fi
286
286
else
287
287
if [[ $output != " $expected " ]]; then
288
288
batslib_print_kv_single_or_multi 8 \
289
289
' expected' " $expected " \
290
290
' actual' " $output " \
291
291
| batslib_decorate ' output differs' \
292
- | flunk
292
+ | fail
293
293
fi
294
294
fi
295
295
fi
@@ -360,14 +360,14 @@ refute_output() {
360
360
if (( is_match_line )) && (( is_match_contained )) ; then
361
361
echo " \` -l' and \` -l <index>' are mutually exclusive" \
362
362
| batslib_decorate ' ERROR: refute_output' \
363
- | flunk
363
+ | fail
364
364
return $?
365
365
fi
366
366
367
367
if (( is_mode_partial )) && (( is_mode_regex )) ; then
368
368
echo " \` -p' and \` -r' are mutually exclusive" \
369
369
| batslib_decorate ' ERROR: refute_output' \
370
- | flunk
370
+ | fail
371
371
return $?
372
372
fi
373
373
@@ -377,7 +377,7 @@ refute_output() {
377
377
if (( is_mode_regex == 1 )) && [[ ' ' =~ $unexpected ]] || (( $? == 2 )) ; then
378
378
echo " Invalid extended regular expression: \` $unexpected '" \
379
379
| batslib_decorate ' ERROR: refute_output' \
380
- | flunk
380
+ | fail
381
381
return $?
382
382
fi
383
383
@@ -407,7 +407,7 @@ refute_output() {
407
407
batslib_print_kv_multi " ${may_be_multi[@]} "
408
408
fi
409
409
} | batslib_decorate ' no line should match the regular expression' \
410
- | flunk
410
+ | fail
411
411
return $?
412
412
fi
413
413
done
@@ -434,7 +434,7 @@ refute_output() {
434
434
batslib_print_kv_multi " ${may_be_multi[@]} "
435
435
fi
436
436
} | batslib_decorate ' no line should contain substring' \
437
- | flunk
437
+ | fail
438
438
return $?
439
439
fi
440
440
done
@@ -461,7 +461,7 @@ refute_output() {
461
461
batslib_print_kv_multi " ${may_be_multi[@]} "
462
462
fi
463
463
} | batslib_decorate ' line should not be in output' \
464
- | flunk
464
+ | fail
465
465
return $?
466
466
fi
467
467
done
@@ -475,7 +475,7 @@ refute_output() {
475
475
' regex' " $unexpected " \
476
476
' line' " ${lines[$idx]} " \
477
477
| batslib_decorate ' regular expression should not match line' \
478
- | flunk
478
+ | fail
479
479
fi
480
480
elif (( is_mode_partial )) ; then
481
481
if [[ ${lines[$idx]} == * " $unexpected " * ]]; then
@@ -484,15 +484,15 @@ refute_output() {
484
484
' substring' " $unexpected " \
485
485
' line' " ${lines[$idx]} " \
486
486
| batslib_decorate ' line should not contain substring' \
487
- | flunk
487
+ | fail
488
488
fi
489
489
else
490
490
if [[ ${lines[$idx]} == " $unexpected " ]]; then
491
491
batslib_print_kv_single 10 \
492
492
' index' " $idx " \
493
493
' unexpected' " $unexpected " \
494
494
| batslib_decorate ' line should differ' \
495
- | flunk
495
+ | fail
496
496
fi
497
497
fi
498
498
else
@@ -503,22 +503,22 @@ refute_output() {
503
503
' regex' " $unexpected " \
504
504
' output' " $output " \
505
505
| batslib_decorate ' regular expression should not match output' \
506
- | flunk
506
+ | fail
507
507
fi
508
508
elif (( is_mode_partial )) ; then
509
509
if [[ $output == * " $unexpected " * ]]; then
510
510
batslib_print_kv_single_or_multi 9 \
511
511
' substring' " $unexpected " \
512
512
' output' " $output " \
513
513
| batslib_decorate ' output should not contain substring' \
514
- | flunk
514
+ | fail
515
515
fi
516
516
else
517
517
if [[ $output == " $unexpected " ]]; then
518
518
batslib_print_kv_single_or_multi 6 \
519
519
' output' " $output " \
520
520
| batslib_decorate ' output equals, but it was expected to differ' \
521
- | flunk
521
+ | fail
522
522
fi
523
523
fi
524
524
fi
@@ -543,7 +543,7 @@ assert_success() {
543
543
batslib_print_kv_single " $width " ' status' " $status "
544
544
batslib_print_kv_single_or_multi " $width " ' output' " $output "
545
545
} | batslib_decorate ' command failed' \
546
- | flunk
546
+ | fail
547
547
fi
548
548
}
549
549
@@ -569,7 +569,7 @@ assert_failure() {
569
569
if (( status == 0 )) ; then
570
570
batslib_print_kv_single_or_multi 6 ' output' " $output " \
571
571
| batslib_decorate ' command succeeded, but it was expected to fail' \
572
- | flunk
572
+ | fail
573
573
elif (( $# > 0 )) && (( status != expected )) ; then
574
574
{ local -ir width=8
575
575
batslib_print_kv_single " $width " \
@@ -578,6 +578,6 @@ assert_failure() {
578
578
batslib_print_kv_single_or_multi " $width " \
579
579
' output' " $output "
580
580
} | batslib_decorate ' command failed as expected, but status differs' \
581
- | flunk
581
+ | fail
582
582
fi
583
583
}
0 commit comments