about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorRobert Hensing2024-08-12 13:25:30 +0200
committerRobert Hensing2024-08-12 13:47:41 +0200
commit6fa24da815b755e7a521cd7e6808956480af3613 (patch)
tree68b1a27342df24da82b8d69a652204cbeed2e12b /lib
parentc516c03bf4296809ee0f6db30cd02b08ba71ebe8 (diff)
lib/tests/modules.sh: Add loc <depth> optional parameter
Diffstat (limited to 'lib')
-rwxr-xr-xlib/tests/modules.sh8
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]}"