test cargo fmt --all -- --check returns success after formatting

This commit is contained in:
gnzlbg 2018-06-15 14:20:39 +02:00
parent fc057c2979
commit aacebc854a

View File

@ -20,6 +20,11 @@ cargo install --force
echo "Integration tests for: ${INTEGRATION}"
cargo fmt -- --version
# Checks that:
#
# * `cargo fmt --all` succeeds without any warnings or errors
# * `cargo test -all` still passes (formatting did not break the build)
# * `cargo fmt --all -- --check` after formatting returns success
function check_fmt {
touch rustfmt.toml
cargo fmt --all -v 2>&1 | tee rustfmt_output
@ -44,6 +49,12 @@ function check_fmt {
if [[ $? != 0 ]]; then
return $?
fi
cargo fmt --all -- --check 2>&1 | tee rustfmt_check_output
if [[ $? != 0 ]]; then
cat rustfmt_check_output
return 1
fi
}
case ${INTEGRATION} in