From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- src/tools/clippy/tests/check-fmt.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/tools/clippy/tests/check-fmt.rs (limited to 'src/tools/clippy/tests/check-fmt.rs') diff --git a/src/tools/clippy/tests/check-fmt.rs b/src/tools/clippy/tests/check-fmt.rs new file mode 100644 index 000000000..0defd45b6 --- /dev/null +++ b/src/tools/clippy/tests/check-fmt.rs @@ -0,0 +1,28 @@ +#![cfg_attr(feature = "deny-warnings", deny(warnings))] +#![warn(rust_2018_idioms, unused_lifetimes)] + +use std::path::PathBuf; +use std::process::Command; + +#[test] +fn fmt() { + if option_env!("RUSTC_TEST_SUITE").is_some() || option_env!("NO_FMT_TEST").is_some() { + return; + } + + let root_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")); + let output = Command::new("cargo") + .current_dir(root_dir) + .args(&["dev", "fmt", "--check"]) + .output() + .unwrap(); + + println!("status: {}", output.status); + println!("stdout: {}", String::from_utf8_lossy(&output.stdout)); + println!("stderr: {}", String::from_utf8_lossy(&output.stderr)); + + assert!( + output.status.success(), + "Formatting check failed. Run `cargo dev fmt` to update formatting." + ); +} -- cgit v1.2.3