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()