mirror of
https://gitee.com/openharmony/third_party_rust_serde
synced 2024-11-23 15:01:05 +00:00
Run expansion tests only if rustfmt is present
This commit is contained in:
parent
e2ff603587
commit
23db3a41e7
@ -12,11 +12,14 @@ unstable = ["serde/unstable"]
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
serde = { path = "../serde" }
|
serde = { path = "../serde" }
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
toolchain_find = "0.1"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
fnv = "1.0"
|
fnv = "1.0"
|
||||||
|
macrotest = "=1.0.0"
|
||||||
rustversion = "1.0"
|
rustversion = "1.0"
|
||||||
serde = { path = "../serde", features = ["rc", "derive"] }
|
serde = { path = "../serde", features = ["rc", "derive"] }
|
||||||
serde_derive = { path = "../serde_derive", features = ["deserialize_in_place"] }
|
serde_derive = { path = "../serde_derive", features = ["deserialize_in_place"] }
|
||||||
serde_test = { path = "../serde_test" }
|
serde_test = { path = "../serde_test" }
|
||||||
trybuild = "1.0"
|
trybuild = "1.0"
|
||||||
macrotest = "=1.0.0"
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
use std::process::{Command, ExitStatus, Stdio};
|
use std::process::{Command, ExitStatus, Stdio};
|
||||||
|
|
||||||
#[cfg(not(windows))]
|
fn has_cargo_expand() -> bool {
|
||||||
const CARGO_EXPAND: &str = "cargo-expand";
|
let cargo_expand = if cfg!(windows) {
|
||||||
|
"cargo-expand.exe"
|
||||||
|
} else {
|
||||||
|
"cargo-expand"
|
||||||
|
};
|
||||||
|
|
||||||
#[cfg(windows)]
|
Command::new(cargo_expand)
|
||||||
const CARGO_EXPAND: &str = "cargo-expand.exe";
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
if Command::new(CARGO_EXPAND)
|
|
||||||
.arg("--version")
|
.arg("--version")
|
||||||
.stdin(Stdio::null())
|
.stdin(Stdio::null())
|
||||||
.stdout(Stdio::null())
|
.stdout(Stdio::null())
|
||||||
@ -16,7 +16,14 @@ fn main() {
|
|||||||
.as_ref()
|
.as_ref()
|
||||||
.map(ExitStatus::success)
|
.map(ExitStatus::success)
|
||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
{
|
}
|
||||||
println!("cargo:rustc-cfg=cargo_expand");
|
|
||||||
|
fn has_rustfmt() -> bool {
|
||||||
|
toolchain_find::find_installed_component("rustfmt").is_some()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
if has_cargo_expand() && has_rustfmt() {
|
||||||
|
println!("cargo:rustc-cfg=expandtest");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#[cfg_attr(target_os = "emscripten", ignore)]
|
#[cfg_attr(target_os = "emscripten", ignore)]
|
||||||
#[cfg_attr(not(cargo_expand), ignore)]
|
#[cfg_attr(not(expandtest), ignore)]
|
||||||
#[rustversion::attr(not(nightly), ignore)]
|
#[rustversion::attr(not(nightly), ignore)]
|
||||||
#[test]
|
#[test]
|
||||||
fn expandtest() {
|
fn expandtest() {
|
||||||
|
Loading…
Reference in New Issue
Block a user