Skip to content

Commit 4213e92

Browse files
committed
test(package): Show behavior with renamed members
1 parent 10175b1 commit 4213e92

File tree

1 file changed

+112
-0
lines changed

1 file changed

+112
-0
lines changed

tests/testsuite/package.rs

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6492,6 +6492,118 @@ fn workspace_with_capitalized_member() {
64926492
.run();
64936493
}
64946494

6495+
#[cargo_test]
6496+
fn workspace_with_renamed_member() {
6497+
let reg = registry::init();
6498+
6499+
let p = project()
6500+
.file(
6501+
"Cargo.toml",
6502+
r#"
6503+
[workspace]
6504+
members = ["crates/*"]
6505+
"#,
6506+
)
6507+
.file(
6508+
"crates/val-json/Cargo.toml",
6509+
r#"
6510+
[package]
6511+
name = "obeli-sk-val-json"
6512+
version = "0.16.2"
6513+
edition = "2015"
6514+
authors = []
6515+
license = "MIT"
6516+
description = "main"
6517+
repository = "bar"
6518+
6519+
[dependencies]
6520+
"#,
6521+
)
6522+
.file("crates/val-json/src/lib.rs", "pub fn foo() {}")
6523+
.file(
6524+
"crates/concepts/Cargo.toml",
6525+
r#"
6526+
[package]
6527+
name = "obeli-sk-concepts"
6528+
version = "0.16.2"
6529+
edition = "2015"
6530+
authors = []
6531+
license = "MIT"
6532+
description = "main"
6533+
repository = "bar"
6534+
6535+
[dependencies]
6536+
val-json = { package = "obeli-sk-val-json", path = "../val-json", version = "0.16.2" }
6537+
"#,
6538+
)
6539+
.file(
6540+
"crates/concepts/src/lib.rs",
6541+
"pub fn foo() { val_json::foo() }",
6542+
)
6543+
.file(
6544+
"crates/utils/Cargo.toml",
6545+
r#"
6546+
[package]
6547+
name = "obeli-sk-utils"
6548+
version = "0.16.2"
6549+
edition = "2015"
6550+
authors = []
6551+
license = "MIT"
6552+
description = "main"
6553+
repository = "bar"
6554+
6555+
[dependencies]
6556+
concepts = { package = "obeli-sk-concepts", path = "../concepts", version = "0.16.2" }
6557+
val-json = { package = "obeli-sk-val-json", path = "../val-json", version = "0.16.2" }
6558+
"#,
6559+
)
6560+
.file(
6561+
"crates/utils/src/lib.rs",
6562+
"pub fn foo() { val_json::foo(); concepts::foo(); }",
6563+
)
6564+
.build();
6565+
6566+
p.cargo("package -Zpackage-workspace")
6567+
.masquerade_as_nightly_cargo(&["package-workspace"])
6568+
.replace_crates_io(reg.index_url())
6569+
.with_status(101)
6570+
.with_stderr_data(
6571+
str![[r#"
6572+
[UPDATING] crates.io index
6573+
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
6574+
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
6575+
[PACKAGING] obeli-sk-val-json v0.16.2 ([ROOT]/foo/crates/val-json)
6576+
[PACKAGING] obeli-sk-concepts v0.16.2 ([ROOT]/foo/crates/concepts)
6577+
[PACKAGING] obeli-sk-utils v0.16.2 ([ROOT]/foo/crates/utils)
6578+
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
6579+
[VERIFYING] obeli-sk-val-json v0.16.2 ([ROOT]/foo/crates/val-json)
6580+
[COMPILING] obeli-sk-val-json v0.16.2 ([ROOT]/foo/target/package/obeli-sk-val-json-0.16.2)
6581+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
6582+
[VERIFYING] obeli-sk-concepts v0.16.2 ([ROOT]/foo/crates/concepts)
6583+
[UNPACKING] obeli-sk-val-json v0.16.2 (registry `[ROOT]/foo/target/package/tmp-registry`)
6584+
[COMPILING] obeli-sk-val-json v0.16.2
6585+
[COMPILING] obeli-sk-concepts v0.16.2 ([ROOT]/foo/target/package/obeli-sk-concepts-0.16.2)
6586+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
6587+
[VERIFYING] obeli-sk-utils v0.16.2 ([ROOT]/foo/crates/utils)
6588+
[UNPACKING] obeli-sk-concepts v0.16.2 (registry `[ROOT]/foo/target/package/tmp-registry`)
6589+
[COMPILING] obeli-sk-val-json v0.16.2
6590+
[COMPILING] obeli-sk-concepts v0.16.2
6591+
error[E0433]: failed to resolve: use of undeclared crate or module `val_json`
6592+
--> [ROOT]/home/.cargo/registry/src/-[HASH]/obeli-sk-concepts-0.16.2/src/lib.rs:1:16
6593+
|
6594+
1 | pub fn foo() { val_json::foo() }
6595+
| ^^^^^^^^ use of undeclared crate or module `val_json`
6596+
6597+
For more information about this error, try `rustc --explain E0433`.
6598+
[ERROR] could not compile `obeli-sk-concepts` (lib) due to 1 previous error
6599+
[ERROR] failed to verify package tarball
6600+
6601+
"#]]
6602+
.unordered(),
6603+
)
6604+
.run();
6605+
}
6606+
64956607
#[cargo_test]
64966608
fn registry_not_in_publish_list() {
64976609
let p = project()

0 commit comments

Comments
 (0)