2023-04-19 18:14:16 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
|
|
|
set -euo pipefail
|
|
|
|
IFS=$'\n\t'
|
|
|
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
|
2023-08-14 19:53:17 +00:00
|
|
|
cd "$DIR/../"
|
2023-04-23 20:12:34 +00:00
|
|
|
REALPATH=$(command -v uu-realpath || command -v realpath)
|
|
|
|
|
2023-08-14 19:53:17 +00:00
|
|
|
function main {
|
|
|
|
local test_names=$(get_test_names "${@}")
|
|
|
|
|
|
|
|
local test
|
|
|
|
while read test; do
|
2023-08-30 03:23:31 +00:00
|
|
|
cargo test --no-default-features --features compare --no-fail-fast --test test_loader "$test" -- --show-output
|
2023-08-14 19:53:17 +00:00
|
|
|
done<<<"$test_names"
|
|
|
|
}
|
2023-04-19 18:14:16 +00:00
|
|
|
|
|
|
|
function get_test_names {
|
2023-08-14 19:53:17 +00:00
|
|
|
local test_file
|
|
|
|
local samples_dir=$($REALPATH "$DIR/../org_mode_samples")
|
2023-04-19 18:14:16 +00:00
|
|
|
for test_file in "$@"
|
|
|
|
do
|
2023-04-19 18:17:31 +00:00
|
|
|
if [ -e "$test_file" ]; then
|
2023-08-14 19:53:17 +00:00
|
|
|
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}"
|
2023-09-01 01:23:51 +00:00
|
|
|
echo "${without_extension//\//_}" | tr '[:upper:]' '[:lower:]'
|
2023-04-19 18:17:31 +00:00
|
|
|
else
|
2023-04-23 01:50:34 +00:00
|
|
|
echo "$test_file" | tr '[:upper:]' '[:lower:]'
|
2023-04-19 18:17:31 +00:00
|
|
|
fi
|
2023-04-19 18:14:16 +00:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2023-08-14 19:53:17 +00:00
|
|
|
main "${@}"
|