mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 15:54:15 +00:00
Skip fmt test if rustfmt is unavailble
This commit is contained in:
parent
cc779c8050
commit
dae4076760
15
tests/fmt.rs
15
tests/fmt.rs
@ -1,3 +1,5 @@
|
||||
use std::process::Command;
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn fmt() {
|
||||
@ -5,9 +7,20 @@ fn fmt() {
|
||||
return;
|
||||
}
|
||||
|
||||
// Skip this test if rustup nightly is unavailable
|
||||
let rustup_output = Command::new("rustup")
|
||||
.args(&["component", "list", "--toolchain", "nightly"])
|
||||
.output()
|
||||
.unwrap();
|
||||
assert!(rustup_output.status.success());
|
||||
let component_output = String::from_utf8_lossy(&rustup_output.stdout);
|
||||
if !component_output.contains("rustfmt") {
|
||||
return;
|
||||
}
|
||||
|
||||
let root_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
||||
let dev_dir = root_dir.join("clippy_dev");
|
||||
let output = std::process::Command::new("cargo")
|
||||
let output = Command::new("cargo")
|
||||
.current_dir(dev_dir)
|
||||
.args(&["+nightly", "run", "--", "fmt", "--check"])
|
||||
.output()
|
||||
|
Loading…
Reference in New Issue
Block a user