Skip to content

Commit 1218145

Browse files
committed
base tests: assert that tests are properly formatted.
1 parent 1fbcbe4 commit 1218145

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

ci/base-tests.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,16 @@ cd clippy_dev && cargo test && cd ..
2727
# Perform various checks for lint registration
2828
./util/dev update_lints --check
2929
cargo +nightly fmt --all -- --check
30+
31+
# make sure tests are formatted
32+
33+
# some lints are sensitive to formatting, exclude some files
34+
needs_formatting=false
35+
for file in `find tests -not -path "tests/ui/methods.rs" -not -path "tests/ui/format.rs" -not -path "tests/ui/empty_line_after_outer_attribute.rs" -not -path "tests/ui/double_parens.rs" -not -path "tests/ui/doc.rs" -not -path "tests/ui/unused_unit.rs" | grep "\.rs$"` ; do
36+
rustfmt ${file} --check || echo "${file} needs reformatting!" ; needs_formatting=true
37+
done
38+
39+
if $needs_reformatting
40+
"Tests need reformatting!"
41+
exit 2
42+
fi

0 commit comments

Comments
 (0)