-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cbfd5b3
commit 93923c9
Showing
8 changed files
with
56 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Tests | ||
--- | ||
|
||
This directory contains test cases for this code. Test cases: | ||
* `passing-workspace` is a minimal passing workspace (one crate). | ||
* `failing-workspace` is a minimal failing workspace (one crate). | ||
|
||
`test.rs` runs each workspace as a test case and ensures the binary passes or fails as desired. |
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,5 @@ | ||
[workspace] | ||
members = ["test-crate"] | ||
|
||
[workspace.lints.rustc] | ||
missing-docs = "deny" |
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,6 @@ | ||
[package] | ||
name = "test-crate" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] |
Empty file.
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,5 @@ | ||
[workspace] | ||
members = ["test-crate"] | ||
|
||
[workspace.lints.rustc] | ||
missing-docs = "deny" |
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,9 @@ | ||
[package] | ||
name = "test-crate" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
|
||
[lints] | ||
workspace = true |
Empty file.
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,23 @@ | ||
use std::process::Command; | ||
|
||
#[test] | ||
fn test_passing_workspace() { | ||
let output = Command::new(env!("CARGO_BIN_EXE_cargo-workspace-lints")) | ||
.arg("workspace-lints") | ||
.arg("tests/passing-workspace/Cargo.toml") | ||
.output() | ||
.expect("Failed to run program"); | ||
assert!(output.status.success(), "{output:?}"); | ||
} | ||
|
||
#[test] | ||
fn test_failing_workspace() { | ||
let output = Command::new(env!("CARGO_BIN_EXE_cargo-workspace-lints")) | ||
.arg("workspace-lints") | ||
.arg("tests/failing-workspace/Cargo.toml") | ||
.output() | ||
.expect("Failed to run program"); | ||
assert!(!output.status.success(), "{output:?}"); | ||
// Check that it mentions the crate that fails | ||
assert!(String::from_utf8_lossy(&output.stderr).contains("tests/failing-workspace/test-crate")); | ||
} |