File tree Expand file tree Collapse file tree 5 files changed +7
-6
lines changed Expand file tree Collapse file tree 5 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ assert_failure() {
63
63
if (( status == 0 )) ; then
64
64
{ local -ir width=6
65
65
batslib_print_kv_single_or_multi " $width " ' output' " $output "
66
- if [[ -n " $stderr " ]]; then
66
+ if [[ -n " ${ stderr-} " ]]; then
67
67
batslib_print_kv_single_or_multi " $width " ' stderr' " $stderr "
68
68
fi
69
69
} \
@@ -76,7 +76,7 @@ assert_failure() {
76
76
' actual' " $status "
77
77
batslib_print_kv_single_or_multi " $width " \
78
78
' output' " $output "
79
- if [[ -n " $stderr " ]]; then
79
+ if [[ -n " ${ stderr-} " ]]; then
80
80
batslib_print_kv_single_or_multi " $width " ' stderr' " $stderr "
81
81
fi
82
82
} \
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ assert_success() {
37
37
{ local -ir width=6
38
38
batslib_print_kv_single " $width " ' status' " $status "
39
39
batslib_print_kv_single_or_multi " $width " ' output' " $output "
40
- if [[ -n " $stderr " ]]; then
40
+ if [[ -n " ${ stderr-} " ]]; then
41
41
batslib_print_kv_single_or_multi " $width " ' stderr' " $stderr "
42
42
fi
43
43
} \
Original file line number Diff line number Diff line change @@ -22,14 +22,14 @@ ERR_MSG
22
22
}
23
23
24
24
@test " assert_failure(): returns 1 and displays \`\$ stderr' if it is set" {
25
+ bats_require_minimum_version 1.5.0
25
26
run --separate-stderr \
26
27
bash -c ' echo "a"
27
28
echo "b" >&2
28
29
exit 0'
30
+ echo " Stderr: $stderr " >&3
29
31
run assert_failure
30
32
31
- echo " Stderr: $stderr " >&3
32
-
33
33
assert_test_fail << 'ERR_MSG '
34
34
35
35
-- command succeeded, but it was expected to fail --
Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ ERR_MSG
40
40
}
41
41
42
42
@test " assert_success(): displays \`\$ stderr' if it is set" {
43
+ bats_require_minimum_version 1.5.0
43
44
run --separate-stderr \
44
45
bash -c ' echo "a"
45
46
echo "b" >&2
Original file line number Diff line number Diff line change @@ -236,7 +236,7 @@ ERR_MSG
236
236
}
237
237
238
238
@test " refute_stderr(): \` --' stops parsing options" {
239
- run echo_err ' --'
239
+ run --separate-stderr echo_err ' --'
240
240
run refute_stderr -- ' -p'
241
241
assert_test_pass
242
242
}
You can’t perform that action at this time.
0 commit comments