1 parent 322f328 commit dfafdc2Copy full SHA for dfafdc2
1 file changed
test/check-fmt.sh
@@ -1,13 +1,17 @@
1
#!/usr/bin/env bash
2
# Fail if any Racket source file is not formatted with `raco fmt` (width 102).
3
+# Comparison ignores CR so the check works on any platform's checkout
4
+# line-ending convention.
5
# Run: bash test/check-fmt.sh
6
set -u
7
8
fail=0
9
files=(main.rkt info.rkt private/*.rkt examples/*.rkt test/*.rkt)
10
11
for f in "${files[@]}"; do
- if ! raco fmt --width 102 "$f" 2>/dev/null | diff -q - "$f" >/dev/null 2>&1; then
12
+ fmt_out=$(raco fmt --width 102 "$f" 2>/dev/null | tr -d '\r')
13
+ file_out=$(tr -d '\r' < "$f")
14
+ if [ "$fmt_out" != "$file_out" ]; then
15
echo "NOT FORMATTED: $f (run: raco fmt -i --width 102 $f)"
16
fail=1
17
fi
0 commit comments