diff options
author | Robert Hensing | 2024-08-12 13:25:30 +0200 |
---|---|---|
committer | Robert Hensing | 2024-08-12 13:47:41 +0200 |
commit | 6fa24da815b755e7a521cd7e6808956480af3613 (patch) | |
tree | 68b1a27342df24da82b8d69a652204cbeed2e12b /lib | |
parent | c516c03bf4296809ee0f6db30cd02b08ba71ebe8 (diff) |
lib/tests/modules.sh: Add loc <depth> optional parameter
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/tests/modules.sh | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/tests/modules.sh b/lib/tests/modules.sh index 7dcfa5231cd1..e7c7f881338b 100755 --- a/lib/tests/modules.sh +++ b/lib/tests/modules.sh @@ -20,10 +20,16 @@ cd "$DIR"/modules pass=0 fail=0 -# prints the location of the call of to the function that calls it +# loc +# prints the location of the call of to the function that calls it +# loc n +# prints the location n levels up the call stack loc() { local caller depth depth=1 + if [[ $# -gt 0 ]]; then + depth=$1 + fi # ( lineno fnname file ) of the caller caller=( $(caller $depth) ) echo "${caller[2]}:${caller[0]}" |