Skip to content

Commit 45da135

Browse files
committed
test(package): Show cargo script mistaken identity
1 parent 7ea222d commit 45da135

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

tests/testsuite/package.rs

+68
Original file line numberDiff line numberDiff line change
@@ -6596,6 +6596,74 @@ fn workspace_with_renamed_member() {
65966596
.run();
65976597
}
65986598

6599+
#[cargo_test]
6600+
fn workspace_with_dot_rs_dir() {
6601+
let reg = registry::init();
6602+
6603+
let p = project()
6604+
.file(
6605+
"Cargo.toml",
6606+
r#"
6607+
[workspace]
6608+
members = ["crates/*"]
6609+
"#,
6610+
)
6611+
.file(
6612+
"crates/foo.rs/Cargo.toml",
6613+
r#"
6614+
[package]
6615+
name = "foo"
6616+
version = "0.16.2"
6617+
edition = "2015"
6618+
authors = []
6619+
license = "MIT"
6620+
description = "main"
6621+
repository = "bar"
6622+
6623+
[dependencies]
6624+
"#,
6625+
)
6626+
.file("crates/foo.rs/src/lib.rs", "pub fn foo() {}")
6627+
.file(
6628+
"crates/bar.rs/Cargo.toml",
6629+
r#"
6630+
[package]
6631+
name = "bar"
6632+
version = "0.16.2"
6633+
edition = "2015"
6634+
authors = []
6635+
license = "MIT"
6636+
description = "main"
6637+
repository = "bar"
6638+
6639+
[dependencies]
6640+
foo = { path = "../foo.rs", version = "0.16.2" }
6641+
"#,
6642+
)
6643+
.file("crates/bar.rs/src/lib.rs", "pub fn foo() {}")
6644+
.build();
6645+
6646+
p.cargo("package -Zpackage-workspace")
6647+
.masquerade_as_nightly_cargo(&["package-workspace"])
6648+
.replace_crates_io(reg.index_url())
6649+
.with_status(101)
6650+
.with_stderr_data(
6651+
str![[r#"
6652+
[PACKAGING] foo v0.16.2 ([ROOT]/foo/crates/foo.rs)
6653+
[ERROR] failed to prepare local package for uploading
6654+
6655+
Caused by:
6656+
Unable to update [ROOT]/foo/crates/foo.rs
6657+
6658+
Caused by:
6659+
Single file packages cannot be used as dependencies
6660+
6661+
"#]]
6662+
.unordered(),
6663+
)
6664+
.run();
6665+
}
6666+
65996667
#[cargo_test]
66006668
fn registry_not_in_publish_list() {
66016669
let p = project()

0 commit comments

Comments
 (0)