File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ BLUE="${ESCAPE}[94m"
29
29
# OUT -> all code under test outputs relevant in the context
30
30
# ERR -> all code under test error outputs relevant in the context
31
31
exec {LOG}>&1
32
+ exec {STACK}>&1
32
33
exec {OUT}>&1
33
34
exec {ERR}>&1
34
35
@@ -42,7 +43,7 @@ fail() {
42
43
[[ ! -z $stdout ]] && [ -s $stdout ] && cat $stdout | sed ' s:^:out> :' | format $GREEN >& $OUT
43
44
[[ ! -z $stderr ]] && [ -s $stderr ] && cat $stderr | sed ' s:^:err> :' | format $RED >& $ERR
44
45
45
- print_stack | grep -v ^$BASH_SOURCE | format " $YELLOW " >& $LOG
46
+ print_stack | grep -v ^$BASH_SOURCE | format " $YELLOW " >& $STACK
46
47
exit 1
47
48
}
48
49
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ test_fail_prints_failure_message() {
66
66
67
67
test_fail_prints_where_is_error () {
68
68
assert_equals " ${BASH_SOURCE} :${LINENO} :${FUNCNAME} ()" \
69
- " $( with_bash_unit_log fail | last_line) "
69
+ " $( with_bash_unit_stack fail | last_line) "
70
70
}
71
71
72
72
test_assert_status_code_succeeds () {
@@ -253,18 +253,26 @@ with_bash_unit_log() {
253
253
with_bash_unit_redirected -l ' &1' " $@ "
254
254
}
255
255
256
+ with_bash_unit_stack () {
257
+ with_bash_unit_redirected -s ' &1' " $@ "
258
+ }
259
+
256
260
with_bash_unit_redirected () {
257
261
local log=/dev/null
262
+ local stack=/dev/null
258
263
local out=/dev/null
259
264
local err=/dev/null
260
265
261
266
unset OPTIND
262
- while getopts " l:o:e:" option
267
+ while getopts " l:s: o:e:" option
263
268
do
264
269
case " $option " in
265
270
l)
266
271
log=$OPTARG
267
272
;;
273
+ s)
274
+ stack=$OPTARG
275
+ ;;
268
276
o)
269
277
out=$OPTARG
270
278
;;
@@ -277,6 +285,7 @@ with_bash_unit_redirected() {
277
285
278
286
(
279
287
eval " exec {LOG}>$log "
288
+ eval " exec {STACK}>$stack "
280
289
eval " exec {OUT}>$out "
281
290
eval " exec {ERR}>$err "
282
291
" $@ "
You can’t perform that action at this time.
0 commit comments