mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
parent
e2348c2db2
commit
1c15c722fe
@ -480,9 +480,16 @@ where
|
|||||||
None => None,
|
None => None,
|
||||||
};
|
};
|
||||||
let vers = vers.as_ref().map(|s| &**s);
|
let vers = vers.as_ref().map(|s| &**s);
|
||||||
|
let vers_spec = if vers.is_none() && source.source_id().is_registry() {
|
||||||
|
// Avoid pre-release versions from crate.io
|
||||||
|
// unless explicitly asked for
|
||||||
|
Some("*")
|
||||||
|
} else {
|
||||||
|
vers
|
||||||
|
};
|
||||||
let dep = Dependency::parse_no_deprecated(
|
let dep = Dependency::parse_no_deprecated(
|
||||||
name,
|
name,
|
||||||
Some(vers.unwrap_or("*")),
|
vers_spec,
|
||||||
source.source_id(),
|
source.source_id(),
|
||||||
)?;
|
)?;
|
||||||
let deps = source.query_vec(&dep)?;
|
let deps = source.query_vec(&dep)?;
|
||||||
|
@ -138,6 +138,31 @@ warning: be sure to add `[..]` to your PATH to be able to run the installed bina
|
|||||||
assert_that(cargo_home(), has_installed_exe("foo"));
|
assert_that(cargo_home(), has_installed_exe("foo"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn installs_beta_version_by_explicit_name_from_git() {
|
||||||
|
let p = git::repo(&paths::root().join("foo"))
|
||||||
|
.file(
|
||||||
|
"Cargo.toml",
|
||||||
|
r#"
|
||||||
|
[package]
|
||||||
|
name = "foo"
|
||||||
|
version = "0.3.0-beta.1"
|
||||||
|
authors = []
|
||||||
|
"#,
|
||||||
|
)
|
||||||
|
.file("src/main.rs", "fn main() {}")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
assert_that(
|
||||||
|
cargo_process("install")
|
||||||
|
.arg("--git")
|
||||||
|
.arg(p.url().to_string())
|
||||||
|
.arg("foo"),
|
||||||
|
execs().with_status(0),
|
||||||
|
);
|
||||||
|
assert_that(cargo_home(), has_installed_exe("foo"));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn missing() {
|
fn missing() {
|
||||||
pkg("foo", "0.0.1");
|
pkg("foo", "0.0.1");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user