mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
test: show pkgid spec + query doesnt work with --package
This commit is contained in:
parent
1ae631085f
commit
a37d122949
@ -3,6 +3,7 @@
|
||||
use std::fmt::{self, Write};
|
||||
|
||||
use crate::messages::raw_rustc_output;
|
||||
use cargo_test_support::compare;
|
||||
use cargo_test_support::install::exe;
|
||||
use cargo_test_support::paths::CargoPathExt;
|
||||
use cargo_test_support::registry::Package;
|
||||
@ -1519,3 +1520,40 @@ fn versionless_package() {
|
||||
)
|
||||
.run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn pkgid_querystring_works() {
|
||||
let git_project = git::new("gitdep", |p| {
|
||||
p.file("Cargo.toml", &basic_manifest("gitdep", "1.0.0"))
|
||||
.file("src/lib.rs", "")
|
||||
});
|
||||
let p = project()
|
||||
.file(
|
||||
"Cargo.toml",
|
||||
&format!(
|
||||
r#"
|
||||
[package]
|
||||
name = "foo"
|
||||
|
||||
[dependencies]
|
||||
gitdep = {{ git = "{}", branch = "master" }}
|
||||
"#,
|
||||
git_project.url()
|
||||
),
|
||||
)
|
||||
.file("src/lib.rs", "")
|
||||
.build();
|
||||
|
||||
p.cargo("generate-lockfile").run();
|
||||
|
||||
let output = p.cargo("pkgid").arg("gitdep").exec_with_output().unwrap();
|
||||
let gitdep_pkgid = String::from_utf8(output.stdout).unwrap();
|
||||
let gitdep_pkgid = gitdep_pkgid.trim();
|
||||
compare::assert_match_exact("git+file://[..]/gitdep?branch=master#1.0.0", &gitdep_pkgid);
|
||||
|
||||
p.cargo("build -p")
|
||||
.arg(gitdep_pkgid)
|
||||
.with_status(101)
|
||||
.with_stderr("[ERROR] package pattern(s) `git+file:///[..]/gitdep?branch=master#1.0.0` not found in workspace `[CWD]`")
|
||||
.run();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user