Skip to content

Commit dfafdc2

Browse files
check-fmt: compare with CR stripped (CRLF-safe on any runner)
1 parent 322f328 commit dfafdc2

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

test/check-fmt.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
#!/usr/bin/env bash
22
# 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.
35
# Run: bash test/check-fmt.sh
46
set -u
57

68
fail=0
79
files=(main.rkt info.rkt private/*.rkt examples/*.rkt test/*.rkt)
810

911
for f in "${files[@]}"; do
10-
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
1115
echo "NOT FORMATTED: $f (run: raco fmt -i --width 102 $f)"
1216
fail=1
1317
fi

0 commit comments

Comments
 (0)