test: lockfile path unstable feature tests

This commit is contained in:
Ifropc 2024-08-17 12:50:52 -07:00
parent 4baaaeccea
commit aa7ead5e72
No known key found for this signature in database
GPG Key ID: D2704D4776B957A8

View File

@ -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";