Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(publish): More dev-dep stripping cases #14327

Merged
merged 1 commit into from
Jul 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions tests/testsuite/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1609,6 +1609,9 @@ fn publish_dev_dep_stripping() {
Package::new("optional-namespaced", "1.0.0")
.feature("cat", &[])
.publish();
Package::new("optional-renamed-dep-feature", "1.0.0")
.feature("cat", &[])
.publish();
Package::new("optional-renamed-namespaced", "1.0.0")
.feature("cat", &[])
.publish();
Expand Down Expand Up @@ -1648,13 +1651,15 @@ fn publish_dev_dep_stripping() {
"normal-only/cat",
"build-only/cat",
"dev-only/cat",
"renamed-dev-only01/cat",
"normal-and-dev/cat",
"target-normal-only/cat",
"target-build-only/cat",
"target-dev-only/cat",
"target-normal-and-dev/cat",
"optional-dep-feature/cat",
"dep:optional-namespaced",
"optional-renamed-dep-feature10/cat",
"dep:optional-renamed-namespaced10",
]

Expand All @@ -1663,13 +1668,15 @@ fn publish_dev_dep_stripping() {
normal-and-dev = { version = "1.0", features = ["cat"] }
optional-dep-feature = { version = "1.0", features = ["cat"], optional = true }
optional-namespaced = { version = "1.0", features = ["cat"], optional = true }
optional-renamed-dep-feature10 = { version = "1.0", features = ["cat"], optional = true, package = "optional-renamed-dep-feature" }
optional-renamed-namespaced10 = { version = "1.0", features = ["cat"], optional = true, package = "optional-renamed-namespaced" }

[build-dependencies]
build-only = { version = "1.0", features = ["cat"] }

[dev-dependencies]
dev-only = { path = "../dev-only", features = ["cat"] }
renamed-dev-only01 = { path = "../renamed-dev-only", features = ["cat"], package = "renamed-dev-only" }
normal-and-dev = { version = "1.0", features = ["cat"] }

[target.'cfg(unix)'.dependencies]
Expand Down Expand Up @@ -1705,6 +1712,26 @@ fn publish_dev_dep_stripping() {
pub fn cat() {}
"#,
)
.file(
"renamed-dev-only/Cargo.toml",
r#"
[package]
name = "renamed-dev-only"
version = "0.1.0"
edition = "2015"
authors = []

[features]
cat = []
"#,
)
.file(
"renamed-dev-only/src/lib.rs",
r#"
#[cfg(feature = "cat")]
pub fn cat() {}
"#,
)
.build();

p.cargo("publish --no-verify")
Expand Down Expand Up @@ -1775,6 +1802,18 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
"target": null,
"version_req": "^1.0"
},
{
"default_features": true,
"explicit_name_in_toml": "optional-renamed-dep-feature10",
"features": [
"cat"
],
"kind": "normal",
"name": "optional-renamed-dep-feature",
"optional": true,
"target": null,
"version_req": "^1.0"
},
{
"default_features": true,
"explicit_name_in_toml": "optional-renamed-namespaced10",
Expand Down Expand Up @@ -1866,6 +1905,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
"target-normal-and-dev/cat",
"optional-dep-feature/cat",
"dep:optional-namespaced",
"optional-renamed-dep-feature10/cat",
"dep:optional-renamed-namespaced10"
]
},
Expand Down Expand Up @@ -1927,6 +1967,12 @@ version = "1.0"
features = ["cat"]
optional = true

[dependencies.optional-renamed-dep-feature10]
version = "1.0"
features = ["cat"]
optional = true
package = "optional-renamed-dep-feature"

[dependencies.optional-renamed-namespaced10]
version = "1.0"
features = ["cat"]
Expand All @@ -1951,6 +1997,7 @@ foo_feature = [
"target-normal-and-dev/cat",
"optional-dep-feature/cat",
"dep:optional-namespaced",
"optional-renamed-dep-feature10/cat",
"dep:optional-renamed-namespaced10",
]

Expand Down