Skip to content

Commit 0fe3876

Browse files
committed
test(add): add test to show current behaviour of cargo check
The test shows the current behaviour of cargo check in a workspace with a single bin crate that is not in the default-members. The suggested command fails.
1 parent 9d63ae2 commit 0fe3876

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/testsuite/check.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,27 @@ fn check_virtual_manifest_one_project() {
515515
.run();
516516
}
517517

518+
#[cargo_test]
519+
fn check_virtual_manifest_one_bin_project_not_in_default_members() {
520+
let p = project()
521+
.file(
522+
"Cargo.toml",
523+
r#"
524+
[workspace]
525+
members = ["bar"]
526+
default-members = []
527+
resolver = "3"
528+
"#,
529+
)
530+
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
531+
.file("bar/src/main.rs", "fn main() { let _ = (1); }")
532+
.build();
533+
534+
p.cargo("check -p bar")
535+
.with_stderr_contains("[..]run `cargo fix --bin \"bar\"` to apply[..]")
536+
.run();
537+
}
538+
518539
#[cargo_test]
519540
fn check_virtual_manifest_glob() {
520541
let p = project()

0 commit comments

Comments
 (0)