tests
This commit is contained in:
Executable
+1503
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,70 @@
|
||||
load 'test_helper'
|
||||
fixtures bats # reuse bats fixtures
|
||||
|
||||
@test "passing test" {
|
||||
reentrant_run bats --formatter cat "${FIXTURE_ROOT}/passing.bats"
|
||||
|
||||
[ "${lines[0]}" == '1..1' ]
|
||||
[ "${lines[1]}" == "suite ${FIXTURE_ROOT}/passing.bats" ]
|
||||
[ "${lines[2]}" == 'begin 1 a passing test' ]
|
||||
[ "${lines[3]}" == 'ok 1 a passing test' ]
|
||||
[ "${#lines[@]}" -eq 4 ]
|
||||
}
|
||||
|
||||
@test "failing test" {
|
||||
reentrant_run bats --formatter cat "${FIXTURE_ROOT}/failing.bats"
|
||||
|
||||
[ "${lines[0]}" == '1..1' ]
|
||||
[ "${lines[1]}" == "suite ${FIXTURE_ROOT}/failing.bats" ]
|
||||
[ "${lines[2]}" == 'begin 1 a failing test' ]
|
||||
[ "${lines[3]}" == 'not ok 1 a failing test' ]
|
||||
[ "${lines[4]}" == "# (in test file ${RELATIVE_FIXTURE_ROOT}/failing.bats, line 4)" ]
|
||||
[ "${lines[5]}" == "# \`eval \"( exit \${STATUS:-1} )\"' failed" ]
|
||||
[ "${#lines[@]}" -eq 6 ]
|
||||
}
|
||||
|
||||
@test "passing test with timing" {
|
||||
reentrant_run bats --formatter cat --timing "${FIXTURE_ROOT}/passing.bats"
|
||||
|
||||
[ "${lines[0]}" == '1..1' ]
|
||||
[ "${lines[1]}" == "suite ${FIXTURE_ROOT}/passing.bats" ]
|
||||
[ "${lines[2]}" == 'begin 1 a passing test' ]
|
||||
[ "${lines[3]::23}" == 'ok 1 a passing test in ' ]
|
||||
[ "${lines[3]: -2}" == 'ms' ]
|
||||
[ "${#lines[@]}" -eq 4 ]
|
||||
}
|
||||
|
||||
@test "failing test with timing" {
|
||||
reentrant_run bats --formatter cat --timing "${FIXTURE_ROOT}/failing.bats"
|
||||
|
||||
[ "${lines[0]}" == '1..1' ]
|
||||
[ "${lines[1]}" == "suite ${FIXTURE_ROOT}/failing.bats" ]
|
||||
[ "${lines[2]}" == 'begin 1 a failing test' ]
|
||||
[ "${lines[3]::27}" == 'not ok 1 a failing test in ' ]
|
||||
[ "${lines[3]: -2}" == 'ms' ]
|
||||
[ "${lines[4]}" == "# (in test file ${RELATIVE_FIXTURE_ROOT}/failing.bats, line 4)" ]
|
||||
[ "${lines[5]}" == "# \`eval \"( exit \${STATUS:-1} )\"' failed" ]
|
||||
[ "${#lines[@]}" -eq 6 ]
|
||||
}
|
||||
|
||||
@test "Cat formatter prints the extended tap stream" {
|
||||
cd "$BATS_ROOT/libexec/bats-core/"
|
||||
|
||||
local formatter="bats-format-cat"
|
||||
|
||||
reentrant_run bash -u "$formatter" <<EOF
|
||||
1..1
|
||||
suite "$FIXTURE_ROOT/failing.bats"
|
||||
# output from setup_file
|
||||
begin 1 test_a_failing_test
|
||||
# fd3 output from test
|
||||
not ok 1 a failing test
|
||||
# (in test file test/fixtures/bats/failing.bats, line 4)
|
||||
# \`eval "( exit ${STATUS:-1} )"' failed
|
||||
begin 2 test_a_successful_test
|
||||
ok 2 a successful test
|
||||
unknown line
|
||||
EOF
|
||||
|
||||
[[ "${#lines[@]}" -eq 11 ]]
|
||||
}
|
||||
@@ -0,0 +1,204 @@
|
||||
@test bats_version_lt {
|
||||
bats_require_minimum_version 1.5.0
|
||||
run ! bats_version_lt 1.0.0 1.0
|
||||
[ "$output" = "ERROR: version '1.0' must be of format <major>.<minor>.<patch>!" ]
|
||||
|
||||
run ! bats_version_lt 1.0 1.0.0
|
||||
[ "$output" = "ERROR: version '1.0' must be of format <major>.<minor>.<patch>!" ]
|
||||
|
||||
run -0 bats_version_lt 1.0.0 2.0.0
|
||||
run -0 bats_version_lt 1.2.0 2.0.0
|
||||
run -0 bats_version_lt 1.2.3 2.0.0
|
||||
run -0 bats_version_lt 1.0.0 1.1.0
|
||||
run -0 bats_version_lt 1.0.2 1.1.0
|
||||
run -0 bats_version_lt 1.0.0 1.0.1
|
||||
|
||||
run -1 bats_version_lt 2.0.0 1.0.0
|
||||
run -1 bats_version_lt 2.0.0 1.2.0
|
||||
run -1 bats_version_lt 2.0.0 1.2.3
|
||||
run -1 bats_version_lt 1.1.0 1.0.0
|
||||
run -1 bats_version_lt 1.1.0 1.0.2
|
||||
run -1 bats_version_lt 1.0.1 1.0.0
|
||||
|
||||
run -2 bats_version_lt 1.0.0 1.0.0
|
||||
}
|
||||
|
||||
@test bats_require_minimum_version {
|
||||
[ "$BATS_GUARANTEED_MINIMUM_VERSION" = 0.0.0 ] # check default
|
||||
|
||||
bats_require_minimum_version 0.1.2 # (a version that should be safe not to fail)
|
||||
[ "${BATS_GUARANTEED_MINIMUM_VERSION}" = 0.1.2 ]
|
||||
|
||||
# a higher version should upgrade
|
||||
bats_require_minimum_version 0.2.3
|
||||
[ "${BATS_GUARANTEED_MINIMUM_VERSION}" = 0.2.3 ]
|
||||
|
||||
# a lower version should not change
|
||||
bats_require_minimum_version 0.1.2
|
||||
[ "${BATS_GUARANTEED_MINIMUM_VERSION}" = 0.2.3 ]
|
||||
}
|
||||
|
||||
@test bats_binary_search {
|
||||
bats_require_minimum_version 1.5.0
|
||||
|
||||
run -2 bats_binary_search "search-value"
|
||||
[ "$output" = "ERROR: bats_binary_search requires exactly 2 arguments: <search value> <array name>" ]
|
||||
|
||||
# unset array = empty array: a bit unfortunate but we can't tell the difference (on older Bash?)
|
||||
unset no_array
|
||||
run -1 bats_binary_search "search-value" "no_array"
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
empty_array=()
|
||||
run -1 bats_binary_search "search-value" "empty_array"
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
odd_length_array=(1 2 3)
|
||||
run -1 bats_binary_search a odd_length_array
|
||||
run -0 bats_binary_search 1 odd_length_array
|
||||
run -0 bats_binary_search 2 odd_length_array
|
||||
run -0 bats_binary_search 3 odd_length_array
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
even_length_array=(1 2 3 4)
|
||||
run -1 bats_binary_search a even_length_array
|
||||
run -0 bats_binary_search 1 even_length_array
|
||||
run -0 bats_binary_search 2 even_length_array
|
||||
run -0 bats_binary_search 3 even_length_array
|
||||
run -0 bats_binary_search 4 even_length_array
|
||||
|
||||
}
|
||||
|
||||
@test bats_sort {
|
||||
local -a empty one_element two_sorted two_elements_reversed three_elements_scrambled
|
||||
|
||||
bats_sort empty
|
||||
echo "empty(${#empty[@]}): ${empty[*]}"
|
||||
[ ${#empty[@]} -eq 0 ]
|
||||
|
||||
bats_sort one_element 1
|
||||
echo "one_element(${#one_element[@]}): ${one_element[*]}"
|
||||
[ ${#one_element[@]} -eq 1 ]
|
||||
[ "${one_element[0]}" = 1 ]
|
||||
|
||||
bats_sort two_sorted 1 2
|
||||
echo "two_sorted(${#two_sorted[@]}): ${two_sorted[*]}"
|
||||
[ ${#two_sorted[@]} -eq 2 ]
|
||||
[ "${two_sorted[0]}" = 1 ]
|
||||
[ "${two_sorted[1]}" = 2 ]
|
||||
|
||||
bats_sort two_elements_reversed 2 1
|
||||
echo "two_elements_reversed(${#two_elements_reversed[@]}): ${two_elements_reversed[*]}"
|
||||
[ ${#two_elements_reversed[@]} -eq 2 ]
|
||||
[ "${two_elements_reversed[0]}" = 1 ]
|
||||
[ "${two_elements_reversed[1]}" = 2 ]
|
||||
|
||||
bats_sort three_elements_scrambled 2 1 3
|
||||
echo "three_elements_scrambled(${#three_elements_scrambled[@]}): ${three_elements_scrambled[*]}"
|
||||
[ ${#three_elements_scrambled[@]} -eq 3 ]
|
||||
[ "${three_elements_scrambled[0]}" = 1 ]
|
||||
[ "${three_elements_scrambled[1]}" = 2 ]
|
||||
[ "${three_elements_scrambled[2]}" = 3 ]
|
||||
}
|
||||
|
||||
@test bats_all_in {
|
||||
bats_require_minimum_version 1.5.0
|
||||
|
||||
local -ra empty=() one=(1) onetwo=(1 2)
|
||||
# find nothing in any array
|
||||
run -0 bats_all_in empty
|
||||
run -0 bats_all_in one
|
||||
run -0 bats_all_in onetwo
|
||||
# find single search value in single element array
|
||||
run -0 bats_all_in one 1
|
||||
# find single search values in multi element array
|
||||
run -0 bats_all_in onetwo 1
|
||||
# find multiple search values in multi element array
|
||||
run -0 bats_all_in onetwo 1 2
|
||||
|
||||
# don't find in empty array
|
||||
run -1 bats_all_in empty 1
|
||||
# don't find in non empty
|
||||
run -1 bats_all_in one 2
|
||||
# don't find smaller values
|
||||
run -1 bats_all_in onetwo 0 1 2
|
||||
# don't find greater values
|
||||
run -1 bats_all_in onetwo 1 2 3
|
||||
}
|
||||
|
||||
@test bats_any_in {
|
||||
bats_require_minimum_version 1.5.0
|
||||
|
||||
# shellcheck disable=SC2030,SC2034
|
||||
local -ra empty=() one=(1) onetwo=(1 2)
|
||||
# empty search set is always false
|
||||
run -1 bats_any_in empty
|
||||
run -1 bats_any_in one
|
||||
run -1 bats_any_in onetwo
|
||||
|
||||
# find single search value in single element array
|
||||
run -0 bats_any_in one 1
|
||||
# find single search values in multi element array
|
||||
run -0 bats_any_in onetwo 2
|
||||
# find multiple search values in multi element array
|
||||
run -0 bats_any_in onetwo 1 2
|
||||
|
||||
# don't find in empty array
|
||||
run -1 bats_any_in empty 1
|
||||
# don't find in non empty
|
||||
run -1 bats_any_in one 2
|
||||
# don't find smaller values
|
||||
run -1 bats_any_in onetwo 0
|
||||
# don't find greater values
|
||||
run -1 bats_any_in onetwo 3
|
||||
}
|
||||
|
||||
@test bats_trim {
|
||||
local empty already_trimmed trimmed whitespaces_within
|
||||
bats_trim empty ""
|
||||
# shellcheck disable=SC2031
|
||||
[ "${empty-NOTSET}" = "" ]
|
||||
|
||||
bats_trim already_trimmed "abc"
|
||||
[ "$already_trimmed" = abc ]
|
||||
|
||||
bats_trim trimmed " abc "
|
||||
[ "$trimmed" = abc ]
|
||||
|
||||
bats_trim whitespaces_within " a b "
|
||||
[ "$whitespaces_within" = "a b" ]
|
||||
}
|
||||
|
||||
@test bats_append_arrays_as_args {
|
||||
bats_require_minimum_version 1.5.0
|
||||
count_and_print_args() {
|
||||
echo "$# $*"
|
||||
}
|
||||
|
||||
run -1 bats_append_arrays_as_args
|
||||
[ "${lines[0]}" == "Error: append_arrays_as_args is missing a command or -- separator" ]
|
||||
|
||||
run -1 bats_append_arrays_as_args --
|
||||
[ "${lines[0]}" == "Error: append_arrays_as_args is missing a command or -- separator" ]
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
empty=()
|
||||
run -0 bats_append_arrays_as_args empty -- count_and_print_args
|
||||
[ "${lines[0]}" == '0 ' ]
|
||||
|
||||
run -0 bats_append_arrays_as_args -- count_and_print_args
|
||||
[ "${lines[0]}" == '0 ' ]
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
arr=(a)
|
||||
run -0 bats_append_arrays_as_args arr -- count_and_print_args
|
||||
[ "${lines[0]}" == '1 a' ]
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
arr2=(b)
|
||||
run -0 bats_append_arrays_as_args arr arr2 -- count_and_print_args
|
||||
[ "${lines[0]}" == '2 a b' ]
|
||||
|
||||
run -0 bats_append_arrays_as_args arr empty arr2 -- count_and_print_args
|
||||
[ "${lines[0]}" == '2 a b' ]
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
# block until at least <barrier-size> processes of this barrier group entered the barrier
|
||||
# once this happened, all latecomers will go through immediately!
|
||||
# WARNING: a barrier group consists of all processes with the same barrier name *and* size!
|
||||
single-use-barrier() { # <barrier-name> <barrier-size> [<timeout-in-seconds> [<sleep-cycle-time>]]
|
||||
local barrier_name="$1"
|
||||
local barrier_size="$2"
|
||||
local timeout_in_seconds="${3:-0}"
|
||||
local sleep_cycle_time="${4:-1}"
|
||||
# use name and size to distinguish between invocations
|
||||
# this will block inconsistent sizes on the same name!
|
||||
local BARRIER_SUFFIX=${barrier_name//\//_}-$barrier_size
|
||||
local BARRIER_FILE="$BATS_SUITE_TMPDIR/barrier-$BARRIER_SUFFIX"
|
||||
# mark our entry for all others
|
||||
# concurrent writes may interleave but should not lose their newlines
|
||||
echo "in-$$" >>"$BARRIER_FILE"
|
||||
local start="$SECONDS"
|
||||
# wait for others to enter
|
||||
while [[ $(wc -l <"$BARRIER_FILE") -lt $barrier_size ]]; do
|
||||
if [[ $timeout_in_seconds -ne 0 && $((SECONDS - start)) -gt $timeout_in_seconds ]]; then
|
||||
mv "$BARRIER_FILE" "$BARRIER_FILE-timeout"
|
||||
printf "ERROR: single-use-barrier %s timed out\n" "$BARRIER_SUFFIX" >&2
|
||||
return 1
|
||||
fi
|
||||
sleep "$sleep_cycle_time"
|
||||
done
|
||||
# mark our exit
|
||||
echo "out-$$" >>"$BARRIER_FILE"
|
||||
}
|
||||
|
||||
# block until at least <latch-size> signalling threads have passed the latch
|
||||
# SINGLE_USE_LATCH_DIR must be exported!
|
||||
single-use-latch::wait() { # <latch-name> <latch-size> [<timeout-in-seconds> [<sleep-cycle-time>]]
|
||||
local latch_name="$1"
|
||||
local latch_size="$2"
|
||||
local timeout_in_seconds="${3:-0}"
|
||||
local sleep_cycle_time="${4:-1}"
|
||||
|
||||
local LATCH_FILE
|
||||
LATCH_FILE="$(single-use-latch::_filename "$latch_name")"
|
||||
local start="$SECONDS"
|
||||
while [[ (! -e "$LATCH_FILE") || $(wc -l <"$LATCH_FILE") -lt $latch_size ]]; do
|
||||
if [[ $timeout_in_seconds -ne 0 && $((SECONDS - start)) -gt $timeout_in_seconds ]]; then
|
||||
printf "ERROR: single-use-latch %s timed out\n" "$latch_name" >&2
|
||||
mv "$LATCH_FILE" "$LATCH_FILE-timeout"
|
||||
return 1
|
||||
fi
|
||||
sleep "$sleep_cycle_time"
|
||||
done
|
||||
}
|
||||
|
||||
# signal the waiting process that the latch was passed
|
||||
# this does not block
|
||||
# SINGLE_USE_LATCH_DIR must be exported!
|
||||
single-use-latch::signal() { # <latch-name>
|
||||
local latch_name="$1"
|
||||
local LATCH_FILE
|
||||
LATCH_FILE="$(single-use-latch::_filename "$latch_name")"
|
||||
# mark our passing
|
||||
# concurrent process might interleave but will still post their newline
|
||||
echo "passed-$$" >>"$LATCH_FILE"
|
||||
}
|
||||
|
||||
single-use-latch::_filename() { # <latch-name>
|
||||
printf "%s\n" "${SINGLE_USE_LATCH_DIR?}/latch-${1//\//_}"
|
||||
}
|
||||
@@ -0,0 +1,198 @@
|
||||
bats_require_minimum_version 1.5.0
|
||||
|
||||
load 'test_helper'
|
||||
fixtures file_setup_teardown
|
||||
|
||||
setup_file() {
|
||||
export SETUP_FILE_EXPORT_TEST=true
|
||||
}
|
||||
|
||||
@test "setup_file is run once per file" {
|
||||
# shellcheck disable=SC2031,SC2030
|
||||
export LOG="$BATS_TEST_TMPDIR/setup_file_once.log"
|
||||
bats "$FIXTURE_ROOT/setup_file.bats"
|
||||
}
|
||||
|
||||
@test "teardown_file is run once per file" {
|
||||
# shellcheck disable=SC2031,SC2030
|
||||
export LOG="$BATS_TEST_TMPDIR/teardown_file_once.log"
|
||||
reentrant_run bats "$FIXTURE_ROOT/teardown_file.bats"
|
||||
[[ $status -eq 0 ]]
|
||||
# output the log for faster debugging
|
||||
cat "$LOG"
|
||||
# expect to find an entry for the tested file
|
||||
grep 'teardown_file.bats' "$LOG"
|
||||
# it should be the only entry
|
||||
run wc -l <"$LOG"
|
||||
[[ $output -eq 1 ]]
|
||||
}
|
||||
|
||||
@test "setup_file is called correctly in multi file suite" {
|
||||
# shellcheck disable=SC2031,SC2030
|
||||
export LOG="$BATS_TEST_TMPDIR/setup_file_multi_file_suite.log"
|
||||
reentrant_run bats "$FIXTURE_ROOT/setup_file.bats" "$FIXTURE_ROOT/no_setup_file.bats" "$FIXTURE_ROOT/setup_file2.bats"
|
||||
[[ $status -eq 0 ]]
|
||||
run wc -l <"$LOG"
|
||||
# each setup_file[2].bats is in the log exactly once!
|
||||
[[ $output -eq 2 ]]
|
||||
grep setup_file.bats "$LOG"
|
||||
grep setup_file2.bats "$LOG"
|
||||
}
|
||||
|
||||
@test "teardown_file is called correctly in multi file suite" {
|
||||
# shellcheck disable=SC2031,SC2030
|
||||
export LOG="$BATS_TEST_TMPDIR/teardown_file_multi_file_suite.log"
|
||||
reentrant_run bats "$FIXTURE_ROOT/teardown_file.bats" "$FIXTURE_ROOT/no_teardown_file.bats" "$FIXTURE_ROOT/teardown_file2.bats"
|
||||
[[ $status -eq 0 ]]
|
||||
run wc -l <"$LOG"
|
||||
# each teardown_file[2].bats is in the log exactly once!
|
||||
[[ $output -eq 2 ]]
|
||||
grep teardown_file.bats "$LOG"
|
||||
grep teardown_file2.bats "$LOG"
|
||||
|
||||
}
|
||||
|
||||
@test "setup_file failure aborts tests for this file" {
|
||||
# this might need to mark them as skipped as the test count is already determined at this point
|
||||
reentrant_run bats "$FIXTURE_ROOT/setup_file_failed.bats"
|
||||
echo "$output"
|
||||
[[ "${lines[0]}" == "1..2" ]]
|
||||
[[ "${lines[1]}" == "not ok 1 setup_file failed" ]]
|
||||
[[ "${lines[2]}" == "# (from function \`setup_file' in test file $RELATIVE_FIXTURE_ROOT/setup_file_failed.bats, line 2)" ]]
|
||||
[[ "${lines[3]}" == "# \`false' failed" ]]
|
||||
[[ "${lines[4]}" == "# bats warning: Executed 1 instead of expected 2 tests" ]] # this warning is expected
|
||||
# to appease the count validator, we would have to reduce the expected number of tests (retroactively?) or
|
||||
# output even those tests that should be skipped due to a failed setup_file.
|
||||
# Since we are already in a failure mode, the additional error does not hurt and is less verbose than
|
||||
# printing all the failed/skipped tests due to the setup failure.
|
||||
}
|
||||
|
||||
@test "teardown_file failure fails at least one test from the file" {
|
||||
reentrant_run bats "$FIXTURE_ROOT/teardown_file_failed.bats"
|
||||
[[ $status -ne 0 ]]
|
||||
echo "$output"
|
||||
[[ "${lines[0]}" == "1..1" ]]
|
||||
[[ "${lines[1]}" == "ok 1 test" ]]
|
||||
[[ "${lines[2]}" == "not ok 2 teardown_file failed" ]]
|
||||
[[ "${lines[3]}" == "# (from function \`teardown_file' in test file $RELATIVE_FIXTURE_ROOT/teardown_file_failed.bats, line 2)" ]]
|
||||
[[ "${lines[4]}" == "# \`false' failed" ]]
|
||||
[[ "${lines[5]}" == "# bats warning: Executed 2 instead of expected 1 tests" ]] # for now this warning is expected
|
||||
# for a failed teardown_file not to change the number of tests being reported, we would have to alter at least one previous test result report
|
||||
# this would require arbitrary amounts of buffering so we simply add our own line with a fake test number
|
||||
# tripping the count validator won't change the overall result, as we already are in a failure mode
|
||||
}
|
||||
|
||||
@test "teardown_file runs even if any test in the file failed" {
|
||||
# shellcheck disable=SC2031,SC2030
|
||||
export LOG="$BATS_TEST_TMPDIR/teardown_file_failed.log"
|
||||
reentrant_run bats "$FIXTURE_ROOT/teardown_file_after_failing_test.bats"
|
||||
[[ $status -ne 0 ]]
|
||||
grep teardown_file_after_failing_test.bats "$LOG"
|
||||
echo "$output"
|
||||
[[ $output == "1..1
|
||||
not ok 1 failing test
|
||||
# (in test file $RELATIVE_FIXTURE_ROOT/teardown_file_after_failing_test.bats, line 6)
|
||||
# \`false' failed" ]]
|
||||
}
|
||||
|
||||
@test "teardown_file should run even after user abort via CTRL-C" {
|
||||
if [[ "${BATS_NUMBER_OF_PARALLEL_JOBS:-1}" -gt 1 ]]; then
|
||||
skip "Aborts don't work in parallel mode"
|
||||
fi
|
||||
# shellcheck disable=SC2031,SC2030
|
||||
export LOG="$BATS_TEST_TMPDIR/teardown_file_abort.log"
|
||||
# guarantee that background processes get their own process group -> pid=pgid
|
||||
set -m
|
||||
SECONDS=0
|
||||
# run testsubprocess in background to not avoid blocking this test
|
||||
bats "$FIXTURE_ROOT/teardown_file_after_long_test.bats" &
|
||||
SUBPROCESS_PID=$!
|
||||
# wait until we enter the test
|
||||
sleep 2
|
||||
# fake sending SIGINT (CTRL-C) to the process group of the background subprocess
|
||||
kill -SIGINT -- -$SUBPROCESS_PID
|
||||
wait # for the test to finish either way (SIGINT or normal execution)
|
||||
echo "Waited: $SECONDS seconds"
|
||||
[[ $SECONDS -lt 10 ]] # make sure we really cut it short with SIGINT
|
||||
# check that teardown_file ran and created the log file
|
||||
[[ -f "$LOG" ]]
|
||||
grep teardown_file_after_long_test.bats "$LOG"
|
||||
# but the test must not have run to the end!
|
||||
run ! grep "test finished successfully" "$LOG"
|
||||
}
|
||||
|
||||
@test "setup_file runs even if all tests in the file are skipped" {
|
||||
# shellcheck disable=SC2031,SC2030
|
||||
export LOG="$BATS_TEST_TMPDIR/setup_file_skipped.log"
|
||||
reentrant_run bats "$FIXTURE_ROOT/setup_file_even_if_all_tests_are_skipped.bats"
|
||||
[[ -f "$LOG" ]]
|
||||
grep setup_file_even_if_all_tests_are_skipped.bats "$LOG"
|
||||
}
|
||||
|
||||
@test "teardown_file runs even if all tests in the file are skipped" {
|
||||
# shellcheck disable=SC2031,SC2030
|
||||
export LOG="$BATS_TEST_TMPDIR/teardown_file_skipped.log"
|
||||
reentrant_run bats "$FIXTURE_ROOT/teardown_file_even_if_all_tests_are_skipped.bats"
|
||||
[[ $status -eq 0 ]]
|
||||
[[ -f "$LOG" ]]
|
||||
grep teardown_file_even_if_all_tests_are_skipped.bats "$LOG"
|
||||
}
|
||||
|
||||
@test "setup_file must not leak context between tests in the same suite" {
|
||||
# example: BATS_ROOT was unset in one test but used in others, therefore, the suite failed
|
||||
# Simulate leaking env var from first to second test by: export SETUP_FILE_VAR="LEAK!"
|
||||
reentrant_run bats "$FIXTURE_ROOT/setup_file_does_not_leak_env.bats" "$FIXTURE_ROOT/setup_file_does_not_leak_env2.bats"
|
||||
echo "$output"
|
||||
[[ $status -eq 0 ]]
|
||||
}
|
||||
|
||||
@test "teardown_file must not leak context between tests in the same suite" {
|
||||
# example: BATS_ROOT was unset in one test but used in others, therefore, the suite failed
|
||||
reentrant_run bats "$FIXTURE_ROOT/teardown_file_does_not_leak.bats" "$FIXTURE_ROOT/teardown_file_does_not_leak2.bats"
|
||||
echo "$output"
|
||||
[[ $status -eq 0 ]]
|
||||
[[ $output == "1..2
|
||||
ok 1 test
|
||||
ok 2 must not see variable from first run" ]]
|
||||
}
|
||||
|
||||
@test "halfway setup_file errors are caught and reported" {
|
||||
reentrant_run bats "$FIXTURE_ROOT/setup_file_halfway_error.bats"
|
||||
[ $status -ne 0 ]
|
||||
echo "$output"
|
||||
[ "${lines[0]}" == "1..1" ]
|
||||
[ "${lines[1]}" == "not ok 1 setup_file failed" ]
|
||||
[ "${lines[2]}" == "# (from function \`setup_file' in test file $RELATIVE_FIXTURE_ROOT/setup_file_halfway_error.bats, line 3)" ]
|
||||
[ "${lines[3]}" == "# \`false' failed" ]
|
||||
}
|
||||
|
||||
@test "halfway teardown_file errors are ignored" {
|
||||
reentrant_run -0 bats "$FIXTURE_ROOT/teardown_file_halfway_error.bats"
|
||||
[ "${lines[0]}" == "1..1" ]
|
||||
[ "${lines[1]}" == "ok 1 empty" ]
|
||||
[ "${#lines[@]}" -eq 2 ]
|
||||
|
||||
}
|
||||
|
||||
@test "variables exported in setup_file are visible in tests" {
|
||||
[[ $SETUP_FILE_EXPORT_TEST == "true" ]]
|
||||
}
|
||||
|
||||
@test "Don't run setup_file for files without tests" {
|
||||
# shellcheck disable=SC2031
|
||||
export LOG="$BATS_TEST_TMPDIR/setup_file.log"
|
||||
# only select the test from no_setup_file
|
||||
reentrant_run bats -f test "$FIXTURE_ROOT/setup_file.bats" "$FIXTURE_ROOT/no_setup_file.bats"
|
||||
|
||||
[ ! -f "$LOG" ] # setup_file must not have been executed!
|
||||
[ "${lines[0]}" == '1..1' ] # but at least one test should have been run
|
||||
}
|
||||
|
||||
@test "Failure in setup_file and teardown_file still prints error message" {
|
||||
reentrant_run ! bats "$FIXTURE_ROOT/error_in_setup_and_teardown_file.bats"
|
||||
[ "${lines[0]}" == '1..1' ]
|
||||
[ "${lines[1]}" == 'not ok 1 setup_file failed' ]
|
||||
[ "${lines[2]}" == "# (from function \`setup_file' in test file $RELATIVE_FIXTURE_ROOT/error_in_setup_and_teardown_file.bats, line 2)" ]
|
||||
[ "${lines[3]}" == "# \`false' failed" ]
|
||||
[ "${#lines[@]}" -eq 4 ]
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
setup() {
|
||||
load test_helper
|
||||
fixtures bats # TODO: move to own folder?
|
||||
REENTRANT_RUN_PRESERVE+=(BATS_LIBEXEC)
|
||||
}
|
||||
|
||||
@test "Without .bats/run-logs --filter-status failed returns an error" {
|
||||
bats_require_minimum_version 1.5.0
|
||||
reentrant_run -1 bats --filter-status failed "$FIXTURE_ROOT/passing_and_failing.bats"
|
||||
[[ "${lines[0]}" == "Error: --filter-status needs '"*".bats/run-logs/' to save failed tests. Please create this folder, add it to .gitignore and try again." ]] || false
|
||||
}
|
||||
|
||||
@test "Without previous recording --filter-status failed runs all tests and then runs only failed and missed tests" {
|
||||
cd "$BATS_TEST_TMPDIR" # don't pollute the source folder
|
||||
cp "$FIXTURE_ROOT/many_passing_and_one_failing.bats" .
|
||||
mkdir -p .bats/run-logs
|
||||
bats_require_minimum_version 1.5.0
|
||||
reentrant_run -1 --separate-stderr bats --filter-status failed "many_passing_and_one_failing.bats"
|
||||
# without previous recording, all tests should be run
|
||||
[ "${lines[0]}" == '1..4' ]
|
||||
[ "$(grep -c 'not ok' <<<"$output")" -eq 1 ]
|
||||
|
||||
# shellcheck disable=SC2154
|
||||
[ "${stderr_lines[0]}" == 'No recording of previous runs found. Running all tests!' ]
|
||||
|
||||
reentrant_run -1 bats --tap --filter-status failed "many_passing_and_one_failing.bats"
|
||||
# now we should only run the failing test
|
||||
[ "${lines[0]}" == 1..1 ]
|
||||
[ "${lines[1]}" == "not ok 1 a failing test" ]
|
||||
|
||||
# add a new test that was missed before
|
||||
echo $'@test missed { :; }' >>"many_passing_and_one_failing.bats"
|
||||
|
||||
find .bats/run-logs/ -type f -print -exec cat {} \;
|
||||
|
||||
reentrant_run -1 bats --tap --filter-status failed "many_passing_and_one_failing.bats"
|
||||
# now we should only run the failing test
|
||||
[ "${lines[0]}" == 1..2 ]
|
||||
[ "${lines[1]}" == "not ok 1 a failing test" ]
|
||||
[ "${lines[4]}" == "ok 2 missed" ]
|
||||
}
|
||||
|
||||
@test "Without previous recording --filter-status passed runs all tests and then runs only passed and missed tests" {
|
||||
cd "$BATS_TEST_TMPDIR" # don't pollute the source folder
|
||||
cp "$FIXTURE_ROOT/many_passing_and_one_failing.bats" .
|
||||
mkdir -p .bats/run-logs
|
||||
bats_require_minimum_version 1.5.0
|
||||
reentrant_run -1 bats --filter-status passed "many_passing_and_one_failing.bats"
|
||||
# without previous recording, all tests should be run
|
||||
[ "${lines[0]}" == 'No recording of previous runs found. Running all tests!' ]
|
||||
[ "${lines[1]}" == '1..4' ]
|
||||
[ "$(grep -c 'not ok' <<<"$output")" -eq 1 ]
|
||||
|
||||
reentrant_run -0 bats --tap --filter-status passed "many_passing_and_one_failing.bats"
|
||||
# now we should only run the passed tests
|
||||
[ "${lines[0]}" == 1..3 ]
|
||||
[ "$(grep -c 'not ok' <<<"$output")" -eq 0 ]
|
||||
|
||||
# add a new test that was missed before
|
||||
echo $'@test missed { :; }' >>"many_passing_and_one_failing.bats"
|
||||
|
||||
reentrant_run -0 bats --tap --filter-status passed "many_passing_and_one_failing.bats"
|
||||
# now we should only run the passed and missed tests
|
||||
[ "${lines[0]}" == 1..4 ]
|
||||
[ "$(grep -c 'not ok' <<<"$output")" -eq 0 ]
|
||||
[ "${lines[4]}" == "ok 4 missed" ]
|
||||
}
|
||||
|
||||
@test "Without previous recording --filter-status missed runs all tests and then runs only missed tests" {
|
||||
cd "$BATS_TEST_TMPDIR" # don't pollute the source folder
|
||||
cp "$FIXTURE_ROOT/many_passing_and_one_failing.bats" .
|
||||
mkdir -p .bats/run-logs
|
||||
bats_require_minimum_version 1.5.0
|
||||
reentrant_run -1 bats --filter-status missed "many_passing_and_one_failing.bats"
|
||||
# without previous recording, all tests should be run
|
||||
[ "${lines[0]}" == 'No recording of previous runs found. Running all tests!' ]
|
||||
[ "${lines[1]}" == '1..4' ]
|
||||
[ "$(grep -c -E '^ok' <<<"$output")" -eq 3 ]
|
||||
|
||||
# add a new test that was missed before
|
||||
echo $'@test missed { :; }' >>"many_passing_and_one_failing.bats"
|
||||
|
||||
reentrant_run -0 bats --tap --filter-status missed "many_passing_and_one_failing.bats"
|
||||
# now we should only run the missed test
|
||||
[ "${lines[0]}" == 1..1 ]
|
||||
[ "${lines[1]}" == "ok 1 missed" ]
|
||||
}
|
||||
|
||||
@test "--filter-status failed gives warning on empty failed test list" {
|
||||
cd "$BATS_TEST_TMPDIR" # don't pollute the source folder
|
||||
cp "$FIXTURE_ROOT/passing.bats" .
|
||||
mkdir -p .bats/run-logs
|
||||
bats_require_minimum_version 1.5.0
|
||||
# have no failing tests
|
||||
reentrant_run -0 bats --filter-status failed "passing.bats"
|
||||
# try to run the empty list of failing tests
|
||||
reentrant_run -0 bats --filter-status failed "passing.bats"
|
||||
[ "${lines[0]}" == "There were no tests of status 'failed' in the last recorded run." ]
|
||||
[ "${lines[1]}" == "1..0" ]
|
||||
[ "${#lines[@]}" -eq 2 ]
|
||||
}
|
||||
|
||||
enforce_own_process_group() {
|
||||
set -m
|
||||
"$@"
|
||||
}
|
||||
|
||||
@test "--filter-status failed does not update list when run is aborted" {
|
||||
if [[ "${BATS_NUMBER_OF_PARALLEL_JOBS:-1}" -gt 1 ]]; then
|
||||
skip "Aborts don't work in parallel mode"
|
||||
fi
|
||||
|
||||
cd "$BATS_TEST_TMPDIR" # don't pollute the source folder
|
||||
cp "$FIXTURE_ROOT/sigint_in_failing_test.bats" .
|
||||
mkdir -p .bats/run-logs
|
||||
|
||||
bats_require_minimum_version 1.5.0
|
||||
# don't hang yet, so we get a useful rerun file
|
||||
reentrant_run -1 env DONT_ABORT=1 bats "sigint_in_failing_test.bats"
|
||||
|
||||
# check that we have exactly one log
|
||||
reentrant_run find .bats/run-logs -name '*.log'
|
||||
[[ "${lines[0]}" == *.log ]] || false
|
||||
[ ${#lines[@]} -eq 1 ]
|
||||
|
||||
local first_run_logs="$output"
|
||||
|
||||
sleep 1 # ensure we would get different timestamps for each run
|
||||
|
||||
# now rerun but abort midrun
|
||||
reentrant_run -1 enforce_own_process_group bats --rerun-failed "sigint_in_failing_test.bats"
|
||||
|
||||
# should not have produced a new log
|
||||
reentrant_run find .bats/run-logs -name '*.log'
|
||||
[ "$first_run_logs" == "$output" ]
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
@test "BATS_TMPDIR is set" {
|
||||
[ "${BATS_TMPDIR}" == "${expected:-}" ]
|
||||
}
|
||||
|
||||
@test "BATS_RUN_TMPDIR has BATS_TMPDIR as a prefix" {
|
||||
local regex="^${BATS_TMPDIR}/.+"
|
||||
[[ ${BATS_RUN_TMPDIR} =~ ${regex} ]]
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
@test "BATS_* variables don't contain double slashes" {
|
||||
for var_name in ${!BATS_@}; do
|
||||
local var_value="${!var_name-}"
|
||||
if [[ "$var_value" == *'//'* ]]; then
|
||||
|
||||
echo "$var_name contains // ${#var_value}: ${var_value}" && false
|
||||
fi
|
||||
done
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Fractional timeout supported in bash 4+
|
||||
if [ "${BASH_VERSINFO[0]}" -lt 4 ]; then
|
||||
timeout=1
|
||||
else
|
||||
timeout=0.01
|
||||
fi
|
||||
|
||||
# Just reading from stdin
|
||||
while read -r -t $timeout foo; do
|
||||
if [ "$foo" == "EXIT" ]; then
|
||||
echo "Found"
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Not found"
|
||||
exit 1
|
||||
@@ -0,0 +1,34 @@
|
||||
function should_be_found { # @test
|
||||
true
|
||||
}
|
||||
|
||||
function should_be_found_with_trailing_whitespace { # @test
|
||||
true
|
||||
}
|
||||
|
||||
should_be_found_with_parens() { #@test
|
||||
true
|
||||
}
|
||||
|
||||
should_be_found_with_parens_and_whitespace() { #@test
|
||||
true
|
||||
}
|
||||
|
||||
function should_be_found_with_function_and_parens() { #@test
|
||||
true
|
||||
}
|
||||
|
||||
function should_be_found_with_function_parens_and_whitespace() { #@test
|
||||
true
|
||||
}
|
||||
|
||||
should_not_be_found() {
|
||||
# shellcheck disable=SC2317
|
||||
false
|
||||
#@test
|
||||
}
|
||||
|
||||
should_not_be_found() {
|
||||
# shellcheck disable=SC2317
|
||||
false
|
||||
} #@test
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
echo "dummy date"
|
||||
@@ -0,0 +1,3 @@
|
||||
@test "foo" {
|
||||
echo "foo"
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
# This does not fail as expected
|
||||
@test "gizmo test" {
|
||||
false
|
||||
}
|
||||
|
||||
@test "gizmo test" "this does fail, as expected" {
|
||||
false
|
||||
}
|
||||
|
||||
# This overrides any previous test from the suite with the same description
|
||||
@test "gizmo test" {
|
||||
true
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
@test "normal test1" {
|
||||
true
|
||||
}
|
||||
|
||||
dynamic_test_with_description() {
|
||||
:
|
||||
}
|
||||
|
||||
bats_test_function --description "Some description" -- dynamic_test_with_description
|
||||
|
||||
dynamic_test_without_description() {
|
||||
:
|
||||
}
|
||||
|
||||
bats_test_function -- dynamic_test_without_description
|
||||
|
||||
parametrized_test() {
|
||||
echo "$BATS_TEST_NAME: $1"
|
||||
false
|
||||
}
|
||||
|
||||
for val in 1 2 "th ree"; do
|
||||
bats_test_function -- parametrized_test "$val"
|
||||
done
|
||||
|
||||
@test "normal test2" {
|
||||
true
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
@test "setting a variable" {
|
||||
# shellcheck disable=SC2030
|
||||
variable=1
|
||||
[ $variable -eq 1 ]
|
||||
}
|
||||
|
||||
@test "variables do not persist across tests" {
|
||||
# shellcheck disable=SC2031
|
||||
[ -z "${variable:-}" ]
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
echo "file1" >>"$TEMPFILE"
|
||||
|
||||
@test "test1" {
|
||||
:
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
echo "file2" >>"$TEMPFILE"
|
||||
|
||||
@test "test 1" {
|
||||
:
|
||||
}
|
||||
|
||||
@test "test 2" {
|
||||
:
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
exit 11
|
||||
@@ -0,0 +1,3 @@
|
||||
@test "$SUITE: test with variable in name" {
|
||||
true
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
if exported_function; then
|
||||
a='exported_function'
|
||||
fi
|
||||
|
||||
@test "failing test" {
|
||||
echo "a='$a'"
|
||||
false
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
load test_helper
|
||||
|
||||
# Test various combinations that may fail line number detection in stack trace
|
||||
# Tests are designed so the first statement succeeds and 2nd fails
|
||||
# All tests fail on the same line so checking can be automated
|
||||
|
||||
@test "Call true function && false stackdepth=1" {
|
||||
help_me
|
||||
help_me && false
|
||||
}
|
||||
|
||||
|
||||
@test "Call true function && return 1 stackdepth=1" {
|
||||
help_me
|
||||
help_me && return 1
|
||||
}
|
||||
|
||||
@test "Call true function and invert stackdepth=2" {
|
||||
help_me
|
||||
# shellcheck disable=SC2314
|
||||
! help_me
|
||||
}
|
||||
|
||||
@test "Call false function || false stackdepth=1" {
|
||||
# shellcheck disable=SC2314
|
||||
! failing_helper
|
||||
failing_helper || false
|
||||
}
|
||||
|
||||
@test "Call false function && return 1 stackdepth=1" {
|
||||
# shellcheck disable=SC2314
|
||||
! failing_helper
|
||||
failing_helper || return 1
|
||||
}
|
||||
|
||||
@test "Call false function stackdepth=2" {
|
||||
# shellcheck disable=SC2314
|
||||
! failing_helper
|
||||
failing_helper
|
||||
}
|
||||
|
||||
|
||||
@test "Call return_0 function && false stackdepth=1" {
|
||||
return_0
|
||||
return_0 && false
|
||||
}
|
||||
|
||||
|
||||
@test "Call return_0 function && return 1 stackdepth=1" {
|
||||
return_0
|
||||
return_0 && return 1
|
||||
}
|
||||
|
||||
@test "Call return_0 function and invert stackdepth=2" {
|
||||
return_0
|
||||
# shellcheck disable=SC2314
|
||||
! return_0
|
||||
}
|
||||
|
||||
@test "Call return_1 function || false stackdepth=1" {
|
||||
# shellcheck disable=SC2314
|
||||
! return_1
|
||||
return_1 || false
|
||||
}
|
||||
|
||||
@test "Call return_1 function && return 1 stackdepth=1" {
|
||||
# shellcheck disable=SC2314
|
||||
! return_1
|
||||
return_1 || return 1
|
||||
}
|
||||
|
||||
@test "Call return_1 function stackdepth=2" {
|
||||
# shellcheck disable=SC2314
|
||||
! return_1
|
||||
return_1
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
setup() {
|
||||
true
|
||||
}
|
||||
|
||||
teardown() {
|
||||
true
|
||||
}
|
||||
|
||||
setup_file() {
|
||||
true
|
||||
}
|
||||
|
||||
teardown_file() {
|
||||
true
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
load external_functions
|
||||
|
||||
@test test {
|
||||
true
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
@test "a failing test" {
|
||||
true
|
||||
true
|
||||
eval "( exit ${STATUS:-1} )"
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
@test "a failing test" {
|
||||
false
|
||||
}
|
||||
|
||||
@test "a passing test" {
|
||||
true
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
load "test_helper"
|
||||
|
||||
@test "failing helper function" {
|
||||
true
|
||||
failing_helper
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
setup() {
|
||||
false
|
||||
}
|
||||
|
||||
@test "truth" {
|
||||
true
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
teardown() {
|
||||
eval "( exit ${STATUS:-1} )"
|
||||
}
|
||||
|
||||
@test "truth" {
|
||||
[ "$PASS" = 1 ]
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
@test "a failing test" {
|
||||
true
|
||||
# shellcheck disable=SC2050
|
||||
[[ 1 == 2 ]]
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
@test "a failing test" {
|
||||
true
|
||||
((1 == 2))
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
@test "a failing test" {
|
||||
true
|
||||
# shellcheck disable=SC2314
|
||||
! true
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
helper() {
|
||||
false
|
||||
}
|
||||
|
||||
helper
|
||||
|
||||
@test "everything is ok" {
|
||||
true
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
@test "unfocused" {
|
||||
false
|
||||
}
|
||||
|
||||
# bats test_tags=bats:focus
|
||||
@test "focused" {
|
||||
true
|
||||
}
|
||||
Vendored
Executable
+4
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
cat >/dev/null # eat up all input
|
||||
sleep 1
|
||||
echo "Finished" # mark finish
|
||||
@@ -0,0 +1,9 @@
|
||||
setup() {
|
||||
load '../../concurrent-coordination'
|
||||
}
|
||||
|
||||
@test "test" {
|
||||
single-use-latch::signal hang_after_run
|
||||
run true
|
||||
sleep 10
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
setup() {
|
||||
load '../../concurrent-coordination'
|
||||
}
|
||||
|
||||
@test "test" {
|
||||
single-use-latch::signal hang_in_run
|
||||
run sleep 10
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
setup_file() {
|
||||
load '../../concurrent-coordination'
|
||||
single-use-latch::signal hang_in_setup_file
|
||||
sleep 10
|
||||
}
|
||||
|
||||
@test "empty" {
|
||||
:
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
teardown() {
|
||||
load '../../concurrent-coordination'
|
||||
single-use-latch::signal hang_in_teardown
|
||||
sleep 10
|
||||
}
|
||||
|
||||
@test "empty" {
|
||||
:
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
teardown_file() {
|
||||
load '../../concurrent-coordination'
|
||||
single-use-latch::signal hang_in_teardown_file
|
||||
sleep 10
|
||||
}
|
||||
|
||||
@test "empty" {
|
||||
:
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
setup() {
|
||||
load '../../concurrent-coordination'
|
||||
}
|
||||
|
||||
@test "test" {
|
||||
single-use-latch::signal hang_in_test
|
||||
sleep 10
|
||||
echo "after sleep" # this should not be printed
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
@test "dash-e on beginning of line" {
|
||||
run cat - <<INPUT
|
||||
-e
|
||||
INPUT
|
||||
test "$output" = "-e"
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
function bgfunc {
|
||||
get_open_fds
|
||||
echo "${FUNCNAME[1]} fds before: (${open_fds[*]})" >>"${LOG_FILE}"
|
||||
close_non_std_fds
|
||||
get_open_fds
|
||||
echo "${FUNCNAME[1]} fds after: (${open_fds[*]})" >>"${LOG_FILE}"
|
||||
sleep 10
|
||||
echo "bgfunc done"
|
||||
return 0
|
||||
}
|
||||
|
||||
# store the list of open FDs in array open_fds
|
||||
function get_open_fds() {
|
||||
open_fds=() # reset output array in case it was already set
|
||||
if [[ ${BASH_VERSINFO[0]} == 3 ]]; then
|
||||
local BASHPID
|
||||
BASHPID=$(bash -c 'echo $PPID')
|
||||
fi
|
||||
local tmpfile
|
||||
tmpfile=$(mktemp "$BATS_SUITE_TMPDIR/fds-XXXXXX")
|
||||
# Avoid opening a new fd to read fds: Don't use <(), glob expansion.
|
||||
# Instead, redirect stdout to file which does not create an extra FD.
|
||||
if [[ -d /proc/$BASHPID/fd ]]; then # Linux
|
||||
ls -1 "/proc/$BASHPID/fd" >"$tmpfile"
|
||||
IFS=$'\n' read -d '' -ra open_fds <"$tmpfile" || true
|
||||
elif command -v lsof >/dev/null; then # MacOS
|
||||
local -a fds
|
||||
lsof -F f -p "$BASHPID" >"$tmpfile"
|
||||
IFS=$'\n' read -d '' -ra fds <"$tmpfile" || true
|
||||
for fd in "${fds[@]}"; do
|
||||
case $fd in
|
||||
f[0-9]*) # filter non fd entries (mainly pid?)
|
||||
open_fds+=("${fd#f}") # cut off f prefix
|
||||
;;
|
||||
esac
|
||||
done
|
||||
elif command -v procstat >/dev/null; then # BSDs
|
||||
local -a columns header
|
||||
procstat fds "$BASHPID" >"$tmpfile"
|
||||
{
|
||||
read -r -a header
|
||||
local fd_column_index=-1
|
||||
for ((i = 0; i < ${#header[@]}; ++i)); do
|
||||
if [[ ${header[$i]} == *FD* ]]; then
|
||||
fd_column_index=$i
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [[ $fd_column_index -eq -1 ]]; then
|
||||
printf "Could not find FD column in procstat" >&2
|
||||
exit 1
|
||||
fi
|
||||
while read -r -a columns; do
|
||||
local fd=${columns[$fd_column_index]}
|
||||
if [[ $fd == [0-9]* ]]; then # only take up numeric entries
|
||||
open_fds+=("$fd")
|
||||
fi
|
||||
done
|
||||
} <"$tmpfile"
|
||||
else
|
||||
# TODO: MSYS (Windows)
|
||||
printf "Neither FD discovery mechanism available\n" >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function close_non_std_fds() {
|
||||
local open_fds non_std_fds=()
|
||||
get_open_fds
|
||||
for fd in "${open_fds[@]}"; do
|
||||
if [[ $fd -gt 2 ]]; then
|
||||
non_std_fds+=("$fd")
|
||||
fi
|
||||
done
|
||||
close_fds "${non_std_fds[@]}"
|
||||
}
|
||||
|
||||
function close_fds() { # <fds...>
|
||||
for fd in "$@"; do
|
||||
eval "exec $fd>&-"
|
||||
done
|
||||
}
|
||||
|
||||
function otherfunc {
|
||||
bgfunc &
|
||||
PID=$!
|
||||
disown
|
||||
return 0
|
||||
}
|
||||
|
||||
setup_file() { # see issue #530
|
||||
bgfunc &
|
||||
}
|
||||
|
||||
@test "min bg" {
|
||||
echo "sec: $SECONDS"
|
||||
otherfunc
|
||||
sleep 1 # leave some space for the background job to print/fail early
|
||||
kill -s 0 -- $PID # fail it the process already finished due to error!
|
||||
echo "sec: $SECONDS"
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
@test "1" {
|
||||
sleep 1
|
||||
}
|
||||
|
||||
@test "2" {
|
||||
sleep 1
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
@test "11" {
|
||||
sleep 1
|
||||
}
|
||||
|
||||
@test "12" {
|
||||
sleep 1
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
@test "no unprefixed variables" {
|
||||
declare -p >"${BATS_DECLARED_VARIABLES_FILE?}"
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
[ -n "$HELPER_NAME" ] || HELPER_NAME="test_helper"
|
||||
load "$HELPER_NAME"
|
||||
|
||||
@test "calling a loaded helper" {
|
||||
help_me
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
# see issue #89
|
||||
loop_func() {
|
||||
local search="none one two tree"
|
||||
local d
|
||||
|
||||
for d in $search; do
|
||||
echo "$d"
|
||||
done
|
||||
}
|
||||
|
||||
@test "loop_func" {
|
||||
run loop_func
|
||||
[[ "${lines[3]}" == 'tree' ]]
|
||||
run loop_func
|
||||
[[ "${lines[2]}" == 'two' ]]
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
@test "a passing test" {
|
||||
true
|
||||
}
|
||||
|
||||
@test "another passing test" {
|
||||
true
|
||||
}
|
||||
|
||||
@test "a failing test" {
|
||||
false
|
||||
}
|
||||
|
||||
@test "yet another passing test" {
|
||||
true
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
@test "error in test" {
|
||||
printf 'foo\nbar'
|
||||
false
|
||||
}
|
||||
|
||||
@test "test function returns nonzero" {
|
||||
printf 'foo\nbar'
|
||||
return 1
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
@test "success writing to stdout" {
|
||||
echo "success stdout 1"
|
||||
echo "success stdout 2"
|
||||
}
|
||||
|
||||
@test "success writing to stderr" {
|
||||
echo "success stderr" >&2
|
||||
}
|
||||
|
||||
@test "failure writing to stdout" {
|
||||
echo "failure stdout 1"
|
||||
echo "failure stdout 2"
|
||||
false
|
||||
}
|
||||
|
||||
@test "failure writing to stderr" {
|
||||
echo "failure stderr" >&2
|
||||
false
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
setup() {
|
||||
export PATH
|
||||
PATH="$(dirname "$BATS_TEST_FILENAME"):$PATH"
|
||||
}
|
||||
|
||||
@test "dummy" {
|
||||
echo "$PATH"
|
||||
run -0 date
|
||||
echo "$output"
|
||||
[ "${output}" = 'dummy date' ]
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
@test "slow test 1" {
|
||||
sleep 3s
|
||||
}
|
||||
|
||||
@test "slow test 2" {
|
||||
sleep 3s
|
||||
}
|
||||
|
||||
@test "slow test 3" {
|
||||
sleep 3s
|
||||
}
|
||||
|
||||
@test "slow test 4" {
|
||||
sleep 3s
|
||||
}
|
||||
|
||||
@test "slow test 5" {
|
||||
sleep 3s
|
||||
}
|
||||
|
||||
@test "slow test 6" {
|
||||
sleep 3s
|
||||
}
|
||||
|
||||
@test "slow test 7" {
|
||||
sleep 3s
|
||||
}
|
||||
|
||||
@test "slow test 8" {
|
||||
sleep 3s
|
||||
}
|
||||
|
||||
@test "slow test 9" {
|
||||
sleep 3s
|
||||
}
|
||||
|
||||
@test "slow test 10" {
|
||||
sleep 3s
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
@test "a passing test" {
|
||||
true
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
@test "a passing test" {
|
||||
true
|
||||
}
|
||||
|
||||
@test "a failing test" {
|
||||
false
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
@test "a passing test" {
|
||||
true
|
||||
}
|
||||
|
||||
@test "a skipped test with no reason" {
|
||||
skip
|
||||
}
|
||||
|
||||
@test "a skipped test with a reason" {
|
||||
skip "for a really good reason"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
@test "a passing test" {
|
||||
true
|
||||
}
|
||||
|
||||
@test "a skipping test" {
|
||||
skip
|
||||
}
|
||||
|
||||
@test "a failing test" {
|
||||
false
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
check_ifs() {
|
||||
if [[ "$IFS" != $' \t\n' ]]; then
|
||||
echo "${FUNCNAME[*]}"
|
||||
echo "${BASH_SOURCE[*]}"
|
||||
hexdump -c <<<"$IFS"
|
||||
exit 1
|
||||
fi >&2
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
load helper.bash
|
||||
|
||||
check_ifs
|
||||
|
||||
teardown_suite() {
|
||||
check_ifs
|
||||
}
|
||||
|
||||
setup_suite() {
|
||||
check_ifs
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
load helper.bash
|
||||
|
||||
check_ifs
|
||||
|
||||
setup_file() {
|
||||
check_ifs
|
||||
}
|
||||
|
||||
teardown_file() {
|
||||
check_ifs
|
||||
}
|
||||
|
||||
@test test {
|
||||
check_ifs
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
@test "no failure prints no output" {
|
||||
run echo success
|
||||
}
|
||||
bats_require_minimum_version 1.5.0 # don't be fooled by order, this will run before the test above!
|
||||
@test "failure prints output" {
|
||||
run echo "fail hard"
|
||||
false
|
||||
}
|
||||
|
||||
@test "empty output on failure" {
|
||||
false
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
@test "no failure prints no output" {
|
||||
run echo success
|
||||
}
|
||||
|
||||
@test "failure prints output" {
|
||||
bats_require_minimum_version 1.5.0
|
||||
run --separate-stderr bash -c 'echo "fail hard"; echo with stderr >&2'
|
||||
false
|
||||
}
|
||||
|
||||
@test "empty output on failure" {
|
||||
false
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
@test 'single-quoted name' {
|
||||
true
|
||||
}
|
||||
|
||||
@test "double-quoted name" {
|
||||
true
|
||||
}
|
||||
|
||||
@test unquoted name {
|
||||
true
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
@test "test 1" {
|
||||
# Don't print anything
|
||||
run bash -c "$BATS_TEST_DIRNAME/cmd_using_stdin.bash"
|
||||
[ "$status" -eq 1 ]
|
||||
[ "$output" = "Not found" ]
|
||||
}
|
||||
|
||||
@test "test 2 with TAB in name" {
|
||||
run bash -c "echo EXIT | $BATS_TEST_DIRNAME/cmd_using_stdin.bash"
|
||||
[ "$status" -eq 0 ]
|
||||
echo "$output"
|
||||
[ "$output" = "Found" ]
|
||||
}
|
||||
|
||||
@test "test 3" {
|
||||
run bash -c "echo EXIT | $BATS_TEST_DIRNAME/cmd_using_stdin.bash"
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = "Found" ]
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
@test "referencing unset parameter fails" {
|
||||
set -u
|
||||
# shellcheck disable=SC2154
|
||||
echo "$unset_parameter"
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
setup() {
|
||||
set -u
|
||||
# shellcheck disable=SC2154
|
||||
echo "$unset_parameter"
|
||||
}
|
||||
|
||||
teardown() {
|
||||
echo "should not capture the next line"
|
||||
false
|
||||
}
|
||||
|
||||
@test "referencing unset parameter fails in setup" {
|
||||
:
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
teardown() {
|
||||
set -u
|
||||
# shellcheck disable=SC2154
|
||||
echo "$unset_parameter"
|
||||
}
|
||||
|
||||
@test "referencing unset parameter fails in teardown" {
|
||||
:
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
BATS_TEST_RETRIES=2 # means three tries per test
|
||||
|
||||
log_caller() {
|
||||
printf "%s %s %s\n" "${BATS_TEST_NAME:-}" "${FUNCNAME[1]}" "${BATS_TEST_TRY_NUMBER:-}" >>"${LOG?}"
|
||||
}
|
||||
|
||||
setup_file() {
|
||||
log_caller
|
||||
}
|
||||
|
||||
teardown_file() {
|
||||
log_caller
|
||||
}
|
||||
|
||||
setup() {
|
||||
log_caller
|
||||
}
|
||||
|
||||
teardown() {
|
||||
log_caller
|
||||
}
|
||||
|
||||
@test "Fail all" {
|
||||
log_caller
|
||||
false
|
||||
}
|
||||
|
||||
@test "Fail once" {
|
||||
log_caller
|
||||
((BATS_TEST_TRY_NUMBER > 1)) || false
|
||||
}
|
||||
|
||||
@test "Override retries" {
|
||||
log_caller
|
||||
# shellcheck disable=SC2034
|
||||
BATS_TEST_RETRIES=1
|
||||
((BATS_TEST_TRY_NUMBER > 2)) || false
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
# shellcheck disable=SC2034
|
||||
BATS_TEST_RETRIES=2 # means three tries per test
|
||||
|
||||
@test "Fail once" {
|
||||
((BATS_TEST_TRY_NUMBER > 1)) || false
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
@test "run long command" {
|
||||
run sleep 3
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
setup() {
|
||||
set -eu
|
||||
}
|
||||
|
||||
teardown() {
|
||||
set -eu
|
||||
}
|
||||
|
||||
@test "skipped test" {
|
||||
skip
|
||||
}
|
||||
|
||||
@test "skipped test with reason" {
|
||||
skip "reason"
|
||||
}
|
||||
|
||||
@test "passing test" {
|
||||
run true
|
||||
}
|
||||
|
||||
@test "failing test" {
|
||||
false
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
LOG="$BATS_TEST_SUITE_TMPDIR/setup.log"
|
||||
|
||||
setup() {
|
||||
echo "$BATS_TEST_NAME" >>"$LOG"
|
||||
}
|
||||
|
||||
@test "one" {
|
||||
[ "$(tail -n 1 "$LOG")" = "test_one" ]
|
||||
}
|
||||
|
||||
@test "two" {
|
||||
[ "$(tail -n 1 "$LOG")" = "test_two" ]
|
||||
}
|
||||
|
||||
@test "three" {
|
||||
[ "$(tail -n 1 "$LOG")" = "test_three" ]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
@test "test" {
|
||||
echo output
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
@test "failing" {
|
||||
if [[ -z "${DONT_ABORT:-}" ]]; then
|
||||
# emulate CTRL-C by sending SIGINT to the whole process group
|
||||
kill -SIGINT -- -"$BATS_ROOT_PID"
|
||||
fi
|
||||
false
|
||||
}
|
||||
|
||||
@test "passing" {
|
||||
:
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
@test "empty" { }
|
||||
|
||||
@test "passing" { true; }
|
||||
|
||||
@test "input redirection" { diff - <(echo hello); } <<EOS
|
||||
hello
|
||||
EOS
|
||||
|
||||
@test "failing" { false; }
|
||||
@@ -0,0 +1,7 @@
|
||||
@test "a skipped test" {
|
||||
skip
|
||||
}
|
||||
|
||||
@test "a skipped test with a reason" {
|
||||
skip "a reason"
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
@test "a skipped test with parentheses in the reason" {
|
||||
skip "a reason (with parentheses)"
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
@test "sourcing nonexistent file fails" {
|
||||
# shellcheck disable=SC1091
|
||||
source "nonexistent file"
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
setup() {
|
||||
# shellcheck disable=SC1091
|
||||
source "nonexistent file"
|
||||
}
|
||||
|
||||
teardown() {
|
||||
echo "should not capture the next line"
|
||||
false
|
||||
}
|
||||
|
||||
@test "sourcing nonexistent file fails in setup" {
|
||||
:
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
teardown() {
|
||||
# shellcheck disable=SC1091
|
||||
source "nonexistent file"
|
||||
}
|
||||
|
||||
@test "sourcing nonexistent file fails in teardown" {
|
||||
:
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
@test "test" {
|
||||
:
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
LOG="$BATS_TEST_SUITE_TMPDIR/teardown.log"
|
||||
|
||||
teardown() {
|
||||
echo "$BATS_TEST_NAME" >>"$LOG"
|
||||
}
|
||||
|
||||
@test "one" {
|
||||
true
|
||||
}
|
||||
|
||||
@test "two" {
|
||||
false
|
||||
}
|
||||
|
||||
@test "three" {
|
||||
true
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
teardown_file() {
|
||||
# shellcheck disable=SC2034
|
||||
status=${STATUS?}
|
||||
return "${TEARDOWN_RETURN_CODE?}"
|
||||
}
|
||||
|
||||
@test "return expected code" {
|
||||
return "${TEST_RETURN_CODE?}"
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
teardown() {
|
||||
status=${STATUS?}
|
||||
return "${TEARDOWN_RETURN_CODE?}"
|
||||
}
|
||||
|
||||
@test "return expected code" {
|
||||
return "${TEST_RETURN_CODE?}"
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
setup_suite() {
|
||||
:
|
||||
}
|
||||
|
||||
teardown_suite() {
|
||||
# shellcheck disable=SC2034
|
||||
status=${STATUS?}
|
||||
return "${TEARDOWN_RETURN_CODE?}"
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
@test test {
|
||||
return "${TEST_RETURN_CODE?}"
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
help_me() {
|
||||
true
|
||||
}
|
||||
|
||||
failing_helper() {
|
||||
false
|
||||
}
|
||||
|
||||
return_0() {
|
||||
# Just return 0. Intentional assignment to boost line numbers
|
||||
result=0
|
||||
return $result
|
||||
}
|
||||
|
||||
return_1() {
|
||||
# Just return 0. Intentional assignment to boost line numbers
|
||||
result=1
|
||||
return $result
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
@test "test with / in / name" {
|
||||
true
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
set -u
|
||||
|
||||
# This file is used to test line number offsets. Any changes to lines will affect tests
|
||||
|
||||
@test "access unbound variable" {
|
||||
unset unset_variable
|
||||
# Add a line for checking line number
|
||||
# shellcheck disable=SC2154
|
||||
foo=$unset_variable
|
||||
}
|
||||
|
||||
@test "access second unbound variable" {
|
||||
unset second_unset_variable
|
||||
# shellcheck disable=SC2034,SC2154
|
||||
foo=$second_unset_variable
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
@@ -0,0 +1,4 @@
|
||||
load unofficial_bash_strict_mode
|
||||
@test "unofficial Bash strict mode conditions met" {
|
||||
:
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
PATH="/usr/local/bin:/usr/bin:/bin"
|
||||
|
||||
@test "PATH is reset" {
|
||||
echo "$PATH"
|
||||
false
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
@test "test" {
|
||||
bats_require_minimum_version 1.5.0
|
||||
run ! echo test
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
@test "no extra whitespace" {
|
||||
:
|
||||
}
|
||||
|
||||
@test "tab at beginning of line" {
|
||||
:
|
||||
}
|
||||
|
||||
@test "tab before description" {
|
||||
:
|
||||
}
|
||||
|
||||
@test "tab before opening brace" {
|
||||
:
|
||||
}
|
||||
|
||||
@test "tabs at beginning of line and before description" {
|
||||
:
|
||||
}
|
||||
|
||||
@test "tabs at beginning, before description, before brace" {
|
||||
:
|
||||
}
|
||||
|
||||
@test "extra whitespace around single-line test" { :; }
|
||||
|
||||
@test "no extra whitespace around single-line test" {:;}
|
||||
|
||||
@test parse unquoted name between extra whitespace {:;}
|
||||
|
||||
@test { {:;} # unquote single brace is a valid description
|
||||
|
||||
@test ' {:;} # empty name from single quote
|
||||
@@ -0,0 +1,3 @@
|
||||
@test "truth" {
|
||||
true
|
||||
}
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
setup_file() {
|
||||
false
|
||||
}
|
||||
|
||||
teardown_file() {
|
||||
false
|
||||
}
|
||||
|
||||
@test dummy {
|
||||
:
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
@test "test" {
|
||||
true
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
@test "first" {
|
||||
true
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
setup_file() {
|
||||
echo "$BATS_TEST_FILENAME" >>"$LOG"
|
||||
}
|
||||
|
||||
@test "Test 1" {
|
||||
true
|
||||
}
|
||||
|
||||
@test "Test 2" {
|
||||
true
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user