From 1218145bc9490ca156cc7a26e922c86c2afe67f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sun, 9 Dec 2018 22:06:29 +0100 Subject: [PATCH] base tests: assert that tests are properly formatted. --- ci/base-tests.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ci/base-tests.sh b/ci/base-tests.sh index 2537f157ad9..6eeab6671cb 100755 --- a/ci/base-tests.sh +++ b/ci/base-tests.sh @@ -27,3 +27,16 @@ cd clippy_dev && cargo test && cd .. # Perform various checks for lint registration ./util/dev update_lints --check cargo +nightly fmt --all -- --check + +# make sure tests are formatted + +# some lints are sensitive to formatting, exclude some files +needs_formatting=false +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 +rustfmt ${file} --check || echo "${file} needs reformatting!" ; needs_formatting=true +done + +if $needs_reformatting + "Tests need reformatting!" + exit 2 +fi