tree-sitter/script/test

65 lines
1.2 KiB
Text
Raw Normal View History

#!/usr/bin/env bash
2016-01-15 11:35:35 -08:00
set -e
function usage {
cat <<-EOF
USAGE
$0 [-dgGhv] [-f focus-string] [-s seed]
OPTIONS
-h print this message
-a Compile C code with the Clang static analyzer
-l run only the corpus tests for the given language
-e run only the corpus tests whose name contain the given string
-s set the seed used to control random behavior
-d print parsing log to stderr
-D pipe tests' stderr to \`dot(1)\` to render an SVG log
EOF
}
export TREE_SITTER_TEST=1
export RUST_TEST_THREADS=1
export RUST_BACKTRACE=full
while getopts "bdl:e:s:gGhpvD" option; do
case ${option} in
h)
usage
exit
;;
l)
export TREE_SITTER_TEST_LANGUAGE_FILTER=${OPTARG}
;;
e)
export TREE_SITTER_TEST_EXAMPLE_FILTER=${OPTARG}
;;
s)
export TREE_SITTER_SEED=${OPTARG}
;;
d)
export TREE_SITTER_ENABLE_LOG=1
;;
D)
export TREE_SITTER_ENABLE_LOG_GRAPHS=1
;;
esac
done
if [[ -n $TREE_SITTER_TEST_LANGUAGE_FILTER || -n $TREE_SITTER_TEST_EXAMPLE_FILTER ]]; then
top_level_filter=corpus
2016-11-18 13:47:31 -08:00
else
top_level_filter=$1
2016-11-18 13:47:31 -08:00
fi
cargo test --jobs 1 $top_level_filter -- --nocapture