diff --git a/scripts/run_integration_test.bash b/scripts/run_integration_test.bash index 7a96aab8..a8899f6e 100755 --- a/scripts/run_integration_test.bash +++ b/scripts/run_integration_test.bash @@ -4,17 +4,27 @@ set -euo pipefail IFS=$'\n\t' DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +cd "$DIR/../" REALPATH=$(command -v uu-realpath || command -v realpath) -samples_dir=$(readlink -f "$DIR/../org_mode_samples") +function main { + local test_names=$(get_test_names "${@}") + + local test + while read test; do + cargo test --no-fail-fast --test test_loader "$test" -- --show-output + done<<<"$test_names" +} function get_test_names { + local test_file + local samples_dir=$($REALPATH "$DIR/../org_mode_samples") for test_file in "$@" do if [ -e "$test_file" ]; then - test_file_full_path=$(readlink -f "$test_file") - relative_to_samples=$($REALPATH --relative-to "$samples_dir" "$test_file_full_path") - without_extension="${relative_to_samples%.org}" + local test_file_full_path=$($REALPATH "$test_file") + local relative_to_samples=$($REALPATH --relative-to "$samples_dir" "$test_file_full_path") + local without_extension="${relative_to_samples%.org}" echo "${without_extension/\//_}" | tr '[:upper:]' '[:lower:]' else echo "$test_file" | tr '[:upper:]' '[:lower:]' @@ -22,6 +32,4 @@ function get_test_names { done } -get_test_names "$@" | while read test; do - (cd "$DIR/../" && cargo test --no-fail-fast --test test_loader "$test" -- --show-output) -done +main "${@}"