From 73e397585f4c5d445be3c9cb107db3c606ba638f Mon Sep 17 00:00:00 2001 From: Rustin170506 Date: Thu, 19 Dec 2024 22:33:42 +0800 Subject: [PATCH] test: add the no lock file case Signed-off-by: Rustin170506 --- tests/testsuite/script.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/testsuite/script.rs b/tests/testsuite/script.rs index c2507cdb15e5..79ab85303730 100644 --- a/tests/testsuite/script.rs +++ b/tests/testsuite/script.rs @@ -1321,6 +1321,23 @@ path+[ROOTURL]/foo#script@0.0.0 .run(); } +#[cargo_test] +fn cmd_pkgid_with_embedded_no_lock_file() { + let p = cargo_test_support::project() + .file("script.rs", ECHO_SCRIPT) + .build(); + + p.cargo("-Zscript pkgid --manifest-path script.rs") + .masquerade_as_nightly_cargo(&["script"]) + .with_status(101) + .with_stderr_data(str![[r#" +[WARNING] `package.edition` is unspecified, defaulting to `2024` +[ERROR] a Cargo.lock must exist for this command + +"#]]) + .run(); +} + #[cargo_test] fn cmd_package_with_embedded() { let p = cargo_test_support::project()