diff --git a/tests/testsuite/build.rs b/tests/testsuite/build.rs index 3c650ca52..b5ad08369 100644 --- a/tests/testsuite/build.rs +++ b/tests/testsuite/build.rs @@ -135,6 +135,27 @@ fn incremental_config() { .run(); } +#[cargo_test] +fn cargo_compile_with_unsupported_mode() { + let p = project() + .file("Cargo.toml", &basic_bin_manifest("foo")) + .file("src/foo.rs", &main_file(r#""i am foo""#, &[])) + .build(); + + p.cargo("build --debug") + .with_stderr( + "\ +error: unexpected argument '--debug' found + +Usage: cargo[EXE] build [OPTIONS] + +For more information, try '--help'. +", + ) + .with_status(1) + .run(); +} + #[cargo_test] fn cargo_compile_with_workspace_excluded() { let p = project().file("src/main.rs", "fn main() {}").build();