Skip to content

Commit

Permalink
quarto file argument requires to escape early processing when no argu…
Browse files Browse the repository at this point in the history
…ment is passed.
  • Loading branch information
cderv committed Oct 18, 2023
1 parent 2649ce5 commit 4941bff
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions tests/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,20 +91,24 @@ else
# Check file argument
SMOKE_ALL_FILES=""
TESTS_TO_RUN=""
for file in "$*"; do
filename=$(basename "$file")
# smoke-all.test.ts works with .qmd, .md and .ipynb but will ignored file starting with _
if [[ $filename =~ ^[^_].*[.]qmd$ ]] || [[ $filename =~ ^[^_].*[.]ipynb$ ]] || [[ $filename =~ ^[^_].*[.]md$ ]]; then
SMOKE_ALL_FILES="${SMOKE_ALL_FILES} ${file}"
elif [[ $file == *.ts ]]; then
TESTS_TO_RUN="${TESTS_TO_RUN} ${file}"
else
echo "#### WARNING"
echo "Only .ts, or .qmd, .md and .ipynb passed to smoke-all.test.ts are accepted (file starting with _ are ignored)."
echo "####"
exit 1
fi
done
if [[ ! -z "$*" ]]; then
for file in "$*"; do
echo $file
filename=$(basename "$file")
# smoke-all.test.ts works with .qmd, .md and .ipynb but will ignored file starting with _
if [[ $filename =~ ^[^_].*[.]qmd$ ]] || [[ $filename =~ ^[^_].*[.]ipynb$ ]] || [[ $filename =~ ^[^_].*[.]md$ ]]; then
SMOKE_ALL_FILES="${SMOKE_ALL_FILES} ${file}"
elif [[ $file =~ .*[.]ts$ ]]; then
TESTS_TO_RUN="${TESTS_TO_RUN} ${file}"
echo $TESTS_TO_RUN
else
echo "#### WARNING"
echo "Only .ts, or .qmd, .md and .ipynb passed to smoke-all.test.ts are accepted (file starting with _ are ignored)."
echo "####"
exit 1
fi
done
fi
if [ "$SMOKE_ALL_FILES" != "" ]; then
if [ "$TESTS_TO_RUN" != "" ]; then
echo "#### WARNING"
Expand Down

0 comments on commit 4941bff

Please sign in to comment.