From 914119940b7c23cc9afe402b75aeae09a0928ec8 Mon Sep 17 00:00:00 2001 From: hi-rustin Date: Fri, 6 Oct 2023 16:16:35 +0800 Subject: [PATCH] Add test for unsupported short config flag --- tests/testsuite/build.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/testsuite/build.rs b/tests/testsuite/build.rs index 1afa83918f0..62d37a910c5 100644 --- a/tests/testsuite/build.rs +++ b/tests/testsuite/build.rs @@ -158,6 +158,27 @@ For more information, try '--help'. .run(); } +#[cargo_test] +fn cargo_compile_with_unsupported_short_config_flag() { + let p = project() + .file("Cargo.toml", &basic_bin_manifest("foo")) + .file("src/foo.rs", &main_file(r#""i am foo""#, &[])) + .build(); + + p.cargo("build -c net.git-fetch-with-cli=true") + .with_stderr( + "\ +error: unexpected argument '-c' 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();