mirror of
https://github.com/sstephenson/bats.git
synced 2024-11-17 11:42:33 +01:00
exec-test: Use printf -v in bats_trim_filename
This commit is contained in:
parent
39440c5782
commit
eaa151fb69
|
@ -127,7 +127,7 @@ bats_print_stack_trace() {
|
|||
|
||||
for frame in "$@"; do
|
||||
bats_frame_filename "$frame" 'filename'
|
||||
filename="$(bats_trim_filename "$filename")"
|
||||
bats_trim_filename "$filename" 'filename'
|
||||
bats_frame_lineno "$frame" 'lineno'
|
||||
|
||||
if [ $index -eq 1 ]; then
|
||||
|
@ -203,13 +203,10 @@ bats_strip_string() {
|
|||
}
|
||||
|
||||
bats_trim_filename() {
|
||||
local filename="$1"
|
||||
local length="${#BATS_CWD}"
|
||||
|
||||
if [ "${filename:0:length+1}" = "${BATS_CWD}/" ]; then
|
||||
echo "${filename:length+1}"
|
||||
if [[ "$1" =~ ^${BATS_CWD}/ ]]; then
|
||||
printf -v "$2" '%s' "${1#$BATS_CWD/}"
|
||||
else
|
||||
echo "$filename"
|
||||
printf -v "$2" '%s' "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
fixtures() {
|
||||
FIXTURE_ROOT="$BATS_TEST_DIRNAME/fixtures/$1"
|
||||
RELATIVE_FIXTURE_ROOT="$(bats_trim_filename "$FIXTURE_ROOT")"
|
||||
bats_trim_filename "$FIXTURE_ROOT" 'RELATIVE_FIXTURE_ROOT'
|
||||
}
|
||||
|
||||
setup() {
|
||||
|
|
Loading…
Reference in New Issue
Block a user