fix: remove unsupported embedded workspace check from cargo pkgid command

Signed-off-by: Rustin170506 <techregister@pm.me>
This commit is contained in:
Rustin170506 2024-12-17 21:39:18 +08:00
parent 59b2ddd448
commit 5465e6a451
2 changed files with 10 additions and 10 deletions

View File

@ -18,13 +18,6 @@ pub fn cli() -> Command {
pub fn exec(gctx: &mut GlobalContext, args: &ArgMatches) -> CliResult {
let ws = args.workspace(gctx)?;
if ws.root_maybe().is_embedded() {
return Err(anyhow::format_err!(
"{} is unsupported by `cargo pkgid`",
ws.root_manifest().display()
)
.into());
}
if args.is_present_with_zero_values("package") {
print_available_packages(&ws)?
}

View File

@ -1297,18 +1297,25 @@ fn cmd_verify_project_with_embedded() {
.run();
}
#[cargo_test]
#[cargo_test(nightly, reason = "edition2024 hasn't hit stable yet")]
fn cmd_pkgid_with_embedded() {
let p = cargo_test_support::project()
.file("script.rs", ECHO_SCRIPT)
.build();
p.cargo("-Zscript script.rs")
.masquerade_as_nightly_cargo(&["script"])
.run();
// FIXME: It should be `path+[ROOTURL]/foo/script.rs#script@0.0.0`.
p.cargo("-Zscript pkgid --manifest-path script.rs")
.masquerade_as_nightly_cargo(&["script"])
.with_status(101)
.with_stdout_data(str![[r#"
path+[ROOTURL]/foo#script@0.0.0
"#]])
.with_stderr_data(str![[r#"
[WARNING] `package.edition` is unspecified, defaulting to `2024`
[ERROR] [ROOT]/foo/script.rs is unsupported by `cargo pkgid`
"#]])
.run();