1
0
mirror of https://github.com/sstephenson/bats.git synced 2024-09-29 20:48:27 +02:00

exec-test: Refactor bats_frame_* functions

Preserves existing behavior. Next step will be to take the target
variable name as the second argument.
This commit is contained in:
Mike Bland 2017-02-14 16:22:02 -05:00
parent 55bf719772
commit a3396cbc89
No known key found for this signature in database
GPG Key ID: 5121C73A6E07384B

View File

@ -166,28 +166,22 @@ bats_print_failed_command() {
}
bats_frame_lineno() {
local frame="$1"
local lineno="${frame%% *}"
echo "$lineno"
printf '%s\n' "${1%% *}"
}
bats_frame_function() {
local frame="$1"
local rest="${frame#* }"
local fn="${rest%% *}"
echo "$fn"
local __bff_function="${1#* }"
printf '%s\n' "${__bff_function%% *}"
}
bats_frame_filename() {
local frame="$1"
local rest="${frame#* }"
local filename="${rest#* }"
local __bff_filename="${1#* }"
__bff_filename="${__bff_filename#* }"
if [ "$filename" = "$BATS_TEST_SOURCE" ]; then
echo "$BATS_TEST_FILENAME"
else
echo "$filename"
if [ "$__bff_filename" = "$BATS_TEST_SOURCE" ]; then
__bff_filename="$BATS_TEST_FILENAME"
fi
printf '%s\n' "$__bff_filename"
}
bats_extract_line() {