Skip to content

Commit a37d122

Browse files
committed
test: show pkgid spec + query doesnt work with --package
1 parent 1ae6310 commit a37d122

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

tests/testsuite/check.rs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
use std::fmt::{self, Write};
44

55
use crate::messages::raw_rustc_output;
6+
use cargo_test_support::compare;
67
use cargo_test_support::install::exe;
78
use cargo_test_support::paths::CargoPathExt;
89
use cargo_test_support::registry::Package;
@@ -1519,3 +1520,40 @@ fn versionless_package() {
15191520
)
15201521
.run();
15211522
}
1523+
1524+
#[cargo_test]
1525+
fn pkgid_querystring_works() {
1526+
let git_project = git::new("gitdep", |p| {
1527+
p.file("Cargo.toml", &basic_manifest("gitdep", "1.0.0"))
1528+
.file("src/lib.rs", "")
1529+
});
1530+
let p = project()
1531+
.file(
1532+
"Cargo.toml",
1533+
&format!(
1534+
r#"
1535+
[package]
1536+
name = "foo"
1537+
1538+
[dependencies]
1539+
gitdep = {{ git = "{}", branch = "master" }}
1540+
"#,
1541+
git_project.url()
1542+
),
1543+
)
1544+
.file("src/lib.rs", "")
1545+
.build();
1546+
1547+
p.cargo("generate-lockfile").run();
1548+
1549+
let output = p.cargo("pkgid").arg("gitdep").exec_with_output().unwrap();
1550+
let gitdep_pkgid = String::from_utf8(output.stdout).unwrap();
1551+
let gitdep_pkgid = gitdep_pkgid.trim();
1552+
compare::assert_match_exact("git+file://[..]/gitdep?branch=master#1.0.0", &gitdep_pkgid);
1553+
1554+
p.cargo("build -p")
1555+
.arg(gitdep_pkgid)
1556+
.with_status(101)
1557+
.with_stderr("[ERROR] package pattern(s) `git+file:///[..]/gitdep?branch=master#1.0.0` not found in workspace `[CWD]`")
1558+
.run();
1559+
}

0 commit comments

Comments
 (0)