From aa7ead5e72df7d63466120bf773e605eb843789f Mon Sep 17 00:00:00 2001 From: Ifropc Date: Sat, 17 Aug 2024 12:50:52 -0700 Subject: [PATCH] test: lockfile path unstable feature tests --- tests/testsuite/lockfile_path.rs | 44 ++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/tests/testsuite/lockfile_path.rs b/tests/testsuite/lockfile_path.rs index 0de0cffbd24..01465a3a266 100644 --- a/tests/testsuite/lockfile_path.rs +++ b/tests/testsuite/lockfile_path.rs @@ -10,6 +10,50 @@ use cargo_test_support::{ basic_bin_manifest, cargo_test, project, symlink_supported, ProjectBuilder, }; +/////////////////////////////// +//// Unstable feature tests start +/////////////////////////////// + +#[cargo_test] +fn must_have_unstable_options() { + let lockfile_path = "mylockfile/is/burried/Cargo.lock"; + let p = make_project().build(); + + p.cargo("generate-lockfile") + .masquerade_as_nightly_cargo(&["lockfile-path"]) + .arg("--lockfile-path") + .arg(lockfile_path) + .with_stderr_data(str![[ + r#"[ERROR] the `--lockfile-path` flag is unstable, pass `-Z unstable-options` to enable it +See https://github.com/rust-lang/cargo/issues/5707 for more information about the `--lockfile-path` flag. + +"#]]) + .with_status(101) + .run(); +} + +#[cargo_test] +fn must_be_nightly() { + let lockfile_path = "mylockfile/is/burried/Cargo.lock"; + let p = make_project().build(); + + p.cargo("generate-lockfile") + .arg("-Zunstable-options") + .arg("--lockfile-path") + .arg(lockfile_path) + .with_stderr_data(str![[ + r#"[ERROR] the `-Z` flag is only accepted on the nightly channel of Cargo, but this is the `stable` channel +See https://doc.rust-lang.org/book/appendix-07-nightly-rust.html for more information about Rust release channels. + +"#]]) + .with_status(101) + .run(); +} + +/////////////////////////////// +//// Unstable feature tests end +/////////////////////////////// + #[cargo_test] fn basic_lockfile_created() { let lockfile_path = "mylockfile/is/burried/Cargo.lock";