Skip to content

Commit

Permalink
Adjust indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Sep 11, 2022
1 parent 0e8d70b commit 171b0ce
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 32 deletions.
12 changes: 6 additions & 6 deletions lib/bats-core/common.bash
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/env bash

bats_prefix_lines_for_tap_output() {
while IFS= read -r line; do
printf '# %s\n' "$line" || break # avoid feedback loop when errors are redirected into BATS_OUT (see #353)
done
if [[ -n "$line" ]]; then
printf '# %s\n' "$line"
fi
while IFS= read -r line; do
printf '# %s\n' "$line" || break # avoid feedback loop when errors are redirected into BATS_OUT (see #353)
done
if [[ -n "$line" ]]; then
printf '# %s\n' "$line"
fi
}

function bats_replace_filename() {
Expand Down
24 changes: 12 additions & 12 deletions lib/bats-core/test_functions.bash
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ bats_internal_load() {

# library_load_path is a library loader
if [[ -f "$library_load_path" ]]; then
# shellcheck disable=SC1090
if ! source "$library_load_path"; then
printf "Error while sourcing library loader at '%s'\n" "$library_load_path" >&2
return 1
fi
return 0
# shellcheck disable=SC1090
if ! source "$library_load_path"; then
printf "Error while sourcing library loader at '%s'\n" "$library_load_path" >&2
return 1
fi
return 0
fi

printf "Passed library load path is neither a library loader nor library directory: %s\n" "$library_load_path" >&2
Expand Down Expand Up @@ -148,9 +148,9 @@ bats_load_library() { # <slug>

# load acts like bats_load_safe but exits the shell instead of returning 1.
load() {
if ! bats_load_safe "$@"; then
exit 1
fi
if ! bats_load_safe "$@"; then
exit 1
fi
}

bats_redirect_stderr_into_file() {
Expand Down Expand Up @@ -258,9 +258,9 @@ run() { # [!|-N] [--keep-empty-lines] [--separate-stderr] [--] <command to run..
bats_separate_lines lines output

if [[ "$output_case" == separate ]]; then
# shellcheck disable=SC2034
read -d '' -r stderr < "$bats_run_separate_stderr_file" || true
bats_separate_lines stderr_lines stderr
# shellcheck disable=SC2034
read -d '' -r stderr < "$bats_run_separate_stderr_file" || true
bats_separate_lines stderr_lines stderr
fi

# shellcheck disable=SC2034
Expand Down
22 changes: 11 additions & 11 deletions lib/bats-core/validator.bash
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,24 @@ bats_test_count_validator() {
# ... count the actual number of [not ] oks...
local actual_number_of_tests=0
while IFS= read -r line; do
# forward line
printf "%s\n" "$line"
case "$line" in
# forward line
printf "%s\n" "$line"
case "$line" in
'ok '*)
(( ++actual_number_of_tests ))
;;
(( ++actual_number_of_tests ))
;;
'not ok'*)
(( ++actual_number_of_tests ))
;;
esac
(( ++actual_number_of_tests ))
;;
esac
done
# ... and error if they are not the same
if [[ "${actual_number_of_tests}" != "${expected_number_of_tests}" ]]; then
printf '# bats warning: Executed %s instead of expected %s tests\n' "$actual_number_of_tests" "$expected_number_of_tests"
return 1
printf '# bats warning: Executed %s instead of expected %s tests\n' "$actual_number_of_tests" "$expected_number_of_tests"
return 1
fi
else
# forward output unchanged
cat
fi
}
}
6 changes: 3 additions & 3 deletions lib/bats-core/warnings.bash
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ bats_generate_warning() { # <warning number> [<printf args for warning string>..
shift
if [[ $warning_number =~ [0-9]+ ]] && ((warning_number < ${#BATS_WARNING_SHORT_DESCS[@]} )); then
{
printf "BW%s: ${BATS_WARNING_SHORT_DESCS[$warning_number]}\n" "${padding:${#warning_number}}${warning_number}" "$@"
bats_capture_stack_trace
BATS_STACK_TRACE_PREFIX=' ' bats_print_stack_trace "${BATS_DEBUG_LAST_STACK_TRACE[@]}"
printf "BW%s: ${BATS_WARNING_SHORT_DESCS[$warning_number]}\n" "${padding:${#warning_number}}${warning_number}" "$@"
bats_capture_stack_trace
BATS_STACK_TRACE_PREFIX=' ' bats_print_stack_trace "${BATS_DEBUG_LAST_STACK_TRACE[@]}"
} >> "$BATS_WARNING_FILE" 2>&3
else
printf "Invalid Bats warning number '%s'. It must be an integer between 1 and %d." "$warning_number" "$((${#BATS_WARNING_SHORT_DESCS[@]} - 1))" >&2
Expand Down

0 comments on commit 171b0ce

Please sign in to comment.