summaryrefslogtreecommitdiffstats
path: root/tests/util.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/util.sh')
-rw-r--r--tests/util.sh12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/util.sh b/tests/util.sh
index ec24958..7dba9fb 100644
--- a/tests/util.sh
+++ b/tests/util.sh
@@ -113,9 +113,13 @@ callers() {
# Print a message including path, line number, and command
debug() {
- local file="${1/#*\/tests\//tests/}"
- set -- "$file" "${@:2}"
- color printf "${BLD}%s:%d:${RST} %s\n %s\n" "$@"
+ local file="$1"
+ local line="$2"
+ local msg="$3"
+ local cmd="$(awk "NR == $line" "$file" 2>/dev/null)" || :
+ file="${file/#*\/tests\//tests/}"
+
+ color printf "${BLD}%s:%d:${RST} %s\n %s\n" "$file" "$line" "$msg" "$cmd"
}
## Deferred cleanup
@@ -163,7 +167,7 @@ pop_defer() {
eval "$cmd" || ret=$?
if ((ret != 0)); then
- debug "$file" $line "${RED}error $ret${RST}" "defer $cmd" >&$DUPERR
+ debug "$file" $line "${RED}error $ret${RST}" >&$DUPERR
fi
return $ret