Skip to content

Commit

Permalink
tweak query test runner
Browse files Browse the repository at this point in the history
  • Loading branch information
tek committed Apr 19, 2024
1 parent cd69808 commit ba8d1fb
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions test/query/run.bash
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ target() {
if [[ $1 == 'update' ]]
then
update=1
shift
fi

tree-sitter test -f 'just compile it' >/dev/null
Expand All @@ -43,9 +44,24 @@ test_file() {
fi
}

for n in $base/*.target
do
test_file $(basename ${n%.*})
done
if [[ -n $1 ]]
then

if [[ -f "$(target $1)" ]]
then
test_file $1
else
echo -e "\e[35m>>>\e[m \e[31mNo such test: \e[34m${1}\e[m"
exit 1
fi

else

for n in $base/*.target
do
test_file $(basename ${n%.*})
done

fi

echo -e "\e[35m>>>\e[m All query tests succeeded."

0 comments on commit ba8d1fb

Please sign in to comment.