Expand description
Helpers for testing cargo package
/ cargo publish
ยงExample
// This replaces `registry::init()` and must be called before `Package::new().publish()`
let registry = RegistryBuilder::new().http_api().http_index().build();
let p = project()
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
version = "0.0.1"
edition = "2015"
authors = []
license = "MIT"
description = "foo"
"#,
)
.file("src/main.rs", "fn main() {}")
.build();
p.cargo("publish --no-verify")
.replace_crates_io(registry.index_url())
.run();
validate_upload(
r#"
{
"authors": [],
"badges": {},
"categories": [],
"deps": [],
"description": "foo",
"documentation": null,
"features": {},
"homepage": null,
"keywords": [],
"license": "MIT",
"license_file": null,
"links": null,
"name": "foo",
"readme": null,
"readme_file": null,
"repository": null,
"rust_version": null,
"vers": "0.0.1"
}
"#,
"foo-0.0.1.crate",
&["Cargo.lock", "Cargo.toml", "Cargo.toml.orig", "src/main.rs"],
);
Functionsยง
- _validate_
upload ๐ - create_
index_ ๐line - read_
le_ ๐u32 - split_
index_ ๐features - Check the
cargo publish
API call to the alternative test registry - Checks the contents of a
.crate
file. - Check the
cargo publish
API call - Check the
cargo publish
API call, with file contents - write_
to_ ๐index