From 478506b132728c7d2d660dd5ffd630f905bf8e41 Mon Sep 17 00:00:00 2001 From: hi-rustin Date: Sat, 7 Oct 2023 20:21:07 +0800 Subject: [PATCH] Add test for unsupported short unstable feature flag Signed-off-by: hi-rustin --- tests/testsuite/build.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/testsuite/build.rs b/tests/testsuite/build.rs index bd4b43b4266f..232ad7ee42cd 100644 --- a/tests/testsuite/build.rs +++ b/tests/testsuite/build.rs @@ -244,6 +244,31 @@ fn cargo_compile_directory_not_cwd() { assert!(p.bin("foo").is_file()); } +#[cargo_test] +fn cargo_compile_with_unsupported_short_unstable_feature_flag() { + let p = project() + .file("Cargo.toml", &basic_bin_manifest("foo")) + .file("src/foo.rs", &main_file(r#""i am foo""#, &[])) + .file(".cargo/config.toml", &"") + .build(); + + p.cargo("-zunstable-options -C foo build") + .masquerade_as_nightly_cargo(&["chdir"]) + .cwd(p.root().parent().unwrap()) + .with_stderr( + "\ +error: unexpected argument '-z' found + +Usage: cargo[EXE] [+toolchain] [OPTIONS] [COMMAND] + cargo [+toolchain] [OPTIONS] -Zscript [ARGS]... + +For more information, try '--help'. +", + ) + .with_status(1) + .run(); +} + #[cargo_test] fn cargo_compile_directory_not_cwd_with_invalid_config() { let p = project()