1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-08 06:53:54 +02:00

tests/vars-and-functions: Add callerPrefix helper

This commit is contained in:
Robert Hensing 2024-07-16 01:40:14 +02:00
parent 783a8341ee
commit f2df3f0c6c
2 changed files with 43 additions and 0 deletions

View file

@ -88,6 +88,10 @@ funBang () {
expect 1 funBang
unset funBang
# callerPrefix can be used by the test framework to improve error messages
# it reports about our call site here
echo "<[$(callerPrefix)]>" | grepQuiet -F "<[test-infra.sh:$LINENO: ]>"
# `grep -v -q` is not what we want for exit codes, but `grepInverse` is
# Avoid `grep -v -q`. The following line proves the point, and if it fails,
# we'll know that `grep` had a breaking change or `-v -q` may not be portable.