-
Notifications
You must be signed in to change notification settings - Fork 27
/
check_spec
executable file
·71 lines (66 loc) · 1.78 KB
/
check_spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#! /bin/sh
set -euo pipefail
#
# How I run the sass-spec checker for rsass.
#
# Default run:
# ./check-spec
# Regenerate the rust tests in tests/spec:
# ./check-spec update-tests
# Just show which "basic" tests are still failing:
# ./check-spec basic
# Generate stats to update lib.rs docs and readme:
# ./check-spec stats
#
cd `dirname "$0"`
update="no"
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/main --autostash >&2)
fi
else
git clone https://github.com/sass/sass-spec.git >&2
fi
IMPL=dart-sass
check() {
cargo build --release --bin rsass --features=unimplemented_args >&2 || exit 1
echo "About to test ${1:-everything}"
(cd sass-spec; \
npm install; \
npm run sass-spec -- --command '../target/release/rsass' --cmd-args='' --impl $IMPL -- $*)
}
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 --text --no-line-number --no-unicode \
'^(\d+) runs, (\d+) passing, (\d+) failures, (\d+) todo, (\d+) ignored, (\d+) errors' \
--replace 'echo "$0"; echo "Progress: $[$2] of $[$1-$4-$5] tests passed"' - \
| bash
;;
"update-tests")
cargo run --release --bin=spectest && cargo fmt
;;
*)
check spec/$1
;;
esac