-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add fmt and clippy tests as part of the test process
So we don't have to have a separate CI target. This is easier to reason, and it's a single test
- Loading branch information
Showing
2 changed files
with
61 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Unless explicitly stated otherwise all files in this repository are licensed | ||
// under the MIT/Apache-2.0 License, at your convenience | ||
// | ||
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2020 | ||
// Datadog, Inc. | ||
#[cfg(test)] | ||
mod tests { | ||
use std::process::Command; | ||
#[test] | ||
fn check_formating() { | ||
let status = Command::new("cargo") | ||
.args(["+nightly", "fmt", "--all", "--", "--check"]) | ||
.status() | ||
.unwrap(); | ||
assert!( | ||
status.success(), | ||
"cargo fmt failed. Note that glommio uses nightly for formatting, so please invoke \ | ||
cargo with +nightly" | ||
); | ||
} | ||
|
||
#[test] | ||
fn check_clippy() { | ||
let status = Command::new("cargo") | ||
.args([ | ||
"clippy", | ||
"--all-targets", | ||
"--all-features", | ||
"--", | ||
"-D", | ||
"warnings", | ||
]) | ||
.status() | ||
.unwrap(); | ||
assert!(status.success()); | ||
} | ||
|
||
#[test] | ||
fn check_dependencies_sorted() { | ||
let status = Command::new("cargo") | ||
.args(["sort", "-w", "-c"]) | ||
.status() | ||
.unwrap(); | ||
assert!( | ||
status.success(), | ||
"cargo-sort not installed or cargo.toml dependencies not sorted" | ||
); | ||
} | ||
} |