Expand description
Interact with the TestRegistry
Β§Example
use cargo_test_support::registry::Package;
use cargo_test_support::project;
use cargo_test_support::str;
// Publish package "a" depending on "b".
Package::new("a", "1.0.0")
.dep("b", "1.0.0")
.file("src/lib.rs", r#"
extern crate b;
pub fn f() -> i32 { b::f() * 2 }
"#)
.publish();
// Publish package "b".
Package::new("b", "1.0.0")
.file("src/lib.rs", r#"
pub fn f() -> i32 { 12 }
"#)
.publish();
// Create a project that uses package "a".
let p = project()
.file("Cargo.toml", r#"
[package]
name = "foo"
version = "0.0.1"
[dependencies]
a = "1.0"
"#)
.file("src/main.rs", r#"
extern crate a;
fn main() { println!("{}", a::f()); }
"#)
.build();
// p.cargo("run").with_stdout_data(str!["24"]).run();Re-exportsΒ§
use crate::git::repo;πuse crate::paths;πuse crate::publish::create_index_line;πuse crate::publish::write_to_index;πuse cargo_util::Sha256;πuse cargo_util::paths::append;πuse flate2::Compression;πuse flate2::write::GzEncoder;πuse std::collections::BTreeMap;πuse std::collections::HashMap;πuse std::fmt;πuse std::fs;πuse std::fs::File;πuse std::io::BufRead;πuse std::io::BufReader;πuse std::io::Read;πuse std::io::Write;πuse std::net::SocketAddr;πuse std::net::TcpListener;πuse std::net::TcpStream;πuse std::path::Path;πuse std::path::PathBuf;πuse std::thread;πuse std::thread::JoinHandle;πuse tar::Builder;πuse tar::Header;πuse url::Url;π
StructsΒ§
- Dependency
- Published package dependency builder, see
Package::add_dep - Http
Server - Http
Server Handle - Mutation π
- A helper struct that collects the arguments for
HttpServer::check_authorized. Based on looking at the request, these are the fields that the authentication header should attest to. - Package
- Published package builder for
TestRegistry - Package
File π - A file to be created in a package.
- Registry
Builder - Prepare a local
TestRegistryfixture - Request
- Request to the test http server
- Response
- Response from the test http server
- Test
Registry - A local registry fixture
EnumsΒ§
- Entry
Data π - Entry with data that corresponds to
tar::EntryType.
ConstantsΒ§
- DEFAULT_
MODE π
FunctionsΒ§
- alt_
api_ path - Path to the alternative-registry version of
api_path - alt_
dl_ path - Path to the alternative-registry version of
dl_path - alt_
init - Setup a local βalternativeβ
TestRegistry - alt_
registry_ path - Path to the alternative-registry version of
registry_path - alt_
registry_ πurl - URL to the alternative-registry version of
registry_url - api_
path - Path to the local web API uploads
- cksum
- Generate a checksum
- dl_path
- Path to download
.cratefiles using the web API endpoint. - generate_
path π - generate_
url π - init
- Setup a local pseudo-crates.io
TestRegistry - registry_
path - Path to the local index for pseudo-crates.io.
- save_
new_ πcrate
Type AliasesΒ§
- Feature
Map π - Request
Callback π