Merge pull request #2788 from gnzlbg/test_check_fmt
test cargo fmt --all -- --check returns success after formatting
This commit is contained in:
commit
75d46b1e12
@ -31,10 +31,9 @@ matrix:
|
||||
- env: INTEGRATION=rand
|
||||
- env: INTEGRATION=rust-clippy
|
||||
- env: INTEGRATION=rust-semverver
|
||||
- env: INTEGRATION=stdsimd
|
||||
- env: INTEGRATION=tempdir
|
||||
allow_failures:
|
||||
# Need to run an lalrpop build step before testing?
|
||||
# See: https://github.com/rust-lang-nursery/rustfmt/issues/2789
|
||||
- env: INTEGRATION=chalk
|
||||
# PR sent
|
||||
- env: INTEGRATION=crater
|
||||
@ -42,8 +41,8 @@ matrix:
|
||||
- env: INTEGRATION=rand
|
||||
# Doesn't build
|
||||
- env: INTEGRATION=rust-clippy
|
||||
# Doesn't build
|
||||
- env: INTEGRATION=rust-semverver
|
||||
# See: https://github.com/rust-lang-nursery/rustfmt/issues/2787
|
||||
- env: INTEGRATION=stdsimd
|
||||
|
||||
before_script:
|
||||
- |
|
||||
|
@ -20,10 +20,15 @@ cargo install --force
|
||||
echo "Integration tests for: ${INTEGRATION}"
|
||||
cargo fmt -- --version
|
||||
|
||||
# Checks that:
|
||||
#
|
||||
# * `cargo fmt --all` succeeds without any warnings or errors
|
||||
# * `cargo fmt --all -- --check` after formatting returns success
|
||||
# * `cargo test -all` still passes (formatting did not break the build)
|
||||
function check_fmt {
|
||||
touch rustfmt.toml
|
||||
cargo fmt --all -v 2>&1 | tee rustfmt_output
|
||||
if [[ $? != 0 ]]; then
|
||||
cargo fmt --all -v |& tee rustfmt_output
|
||||
if [[ ${PIPESTATUS[0]} != 0 ]]; then
|
||||
cat rustfmt_output
|
||||
return 1
|
||||
fi
|
||||
@ -40,6 +45,11 @@ function check_fmt {
|
||||
if [[ $? != 0 ]]; then
|
||||
return 1
|
||||
fi
|
||||
cargo fmt --all -- --check |& tee rustfmt_check_output
|
||||
if [[ ${PIPESTATUS[0]} != 0 ]]; then
|
||||
cat rustfmt_check_output
|
||||
return 1
|
||||
fi
|
||||
cargo test --all
|
||||
if [[ $? != 0 ]]; then
|
||||
return $?
|
||||
|
Loading…
Reference in New Issue
Block a user