Skip to content

Commit

Permalink
test(publish): Consolidate dev-dep stripping tests
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Jul 30, 2024
1 parent 257b72b commit 0ece9b9
Showing 1 changed file with 2 additions and 102 deletions.
104 changes: 2 additions & 102 deletions tests/testsuite/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1598,108 +1598,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
}

#[cargo_test]
fn publish_dev_dep_no_version() {
let registry = RegistryBuilder::new().http_api().http_index().build();

let p = project()
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
version = "0.1.0"
edition = "2015"
authors = []
license = "MIT"
description = "foo"
documentation = "foo"
homepage = "foo"
repository = "foo"
[dev-dependencies]
bar = { path = "bar" }
"#,
)
.file("src/lib.rs", "")
.file("bar/Cargo.toml", &basic_manifest("bar", "0.0.1"))
.file("bar/src/lib.rs", "")
.build();

p.cargo("publish --no-verify")
.replace_crates_io(registry.index_url())
.with_stderr_data(str![[r#"
[UPDATING] crates.io index
[PACKAGING] foo v0.1.0 ([ROOT]/foo)
[PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
[UPLOADING] foo v0.1.0 ([ROOT]/foo)
[UPLOADED] foo v0.1.0 to registry `crates-io`
[NOTE] waiting for `foo v0.1.0` to be available at registry `crates-io`.
You may press ctrl-c to skip waiting; the crate should be available shortly.
[PUBLISHED] foo v0.1.0 at registry `crates-io`
"#]])
.run();

publish::validate_upload_with_contents(
r#"
{
"authors": [],
"badges": {},
"categories": [],
"deps": [],
"description": "foo",
"documentation": "foo",
"features": {},
"homepage": "foo",
"keywords": [],
"license": "MIT",
"license_file": null,
"links": null,
"name": "foo",
"readme": null,
"readme_file": null,
"repository": "foo",
"rust_version": null,
"vers": "0.1.0"
}
"#,
"foo-0.1.0.crate",
&["Cargo.toml", "Cargo.toml.orig", "src/lib.rs"],
&[(
"Cargo.toml",
&format!(
r#"{}
[package]
edition = "2015"
name = "foo"
version = "0.1.0"
authors = []
build = false
autobins = false
autoexamples = false
autotests = false
autobenches = false
description = "foo"
homepage = "foo"
documentation = "foo"
readme = false
license = "MIT"
repository = "foo"
[lib]
name = "foo"
path = "src/lib.rs"
[dev-dependencies]
"#,
cargo::core::manifest::MANIFEST_PREAMBLE
),
)],
);
}

#[cargo_test]
fn publish_with_feature_point_diff_kinds_dep() {
fn publish_dev_dep_stripping() {
let registry = RegistryBuilder::new().http_api().http_index().build();
Package::new("normal-only", "1.0.0")
.feature("cat", &[])
Expand Down Expand Up @@ -2005,6 +1904,7 @@ features = ["cat"]
)],
);
}

#[cargo_test]
fn credentials_ambiguous_filename() {
// `publish` generally requires a remote registry
Expand Down

0 comments on commit 0ece9b9

Please sign in to comment.