cd `dirname "$prog"`
case "$1" in
"-u"|"--update")
update="yes"
shift
;;
esac
if [ -d sass-spec ]; then
if [ "$update" == "yes" ]; then
(cd sass-spec && git fetch >&2 && git rebase origin/master --autostash >&2)
fi
else
git clone https://github.com/sass/sass-spec.git >&2
fi
IMPL=dart-sass
check() {
cargo build --release --features=commandline >&2 || exit 1
echo "About to test $1"
(cd sass-spec && \
bundle install && \
bundle exec sass-spec.rb -c '../target/release/rsass' \
--impl $IMPL spec/$1)
}
list_fails() {
grep ^SassSpec:: | sed -e 's#.*test__##' -e 's# .*##' | sort
}
case "$1" in
"")
check
;;
"-h"|"--help"|"help")
echo "$0 stats ;: Give stats for passes / fails suitable for docs."
echo "$0 ;: just run all the tests"
echo "$0 --help ;: print this help"
echo "Other args will be used as test subset specifications."
echo "Examples: basic core_functions selector-functions"
echo " scss parser values"
;;
"stats")
check \
| rg --no-line-number '^(\d+) runs, (\d+) assertions, (\d+) failures, (\d+) errors, (\d+) skips' \
--replace 'echo "$0"; echo "Progress: $[$1-$3-$4-$5] of $[$1-$5] tests passed"' - \
| bash
;;
"update-tests")
cargo run --release --features=spectest --bin=spectest && cargo fmt
;;
*)
check $1
;;
esac