summaryrefslogtreecommitdiffstats
path: root/src/tools/cargo/tests/testsuite/build.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
commitef24de24a82fe681581cc130f342363c47c0969a (patch)
tree0d494f7e1a38b95c92426f58fe6eaa877303a86c /src/tools/cargo/tests/testsuite/build.rs
parentReleasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz
rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/tools/cargo/tests/testsuite/build.rs')
-rw-r--r--src/tools/cargo/tests/testsuite/build.rs137
1 files changed, 136 insertions, 1 deletions
diff --git a/src/tools/cargo/tests/testsuite/build.rs b/src/tools/cargo/tests/testsuite/build.rs
index 1afa83918..23840ad9a 100644
--- a/src/tools/cargo/tests/testsuite/build.rs
+++ b/src/tools/cargo/tests/testsuite/build.rs
@@ -159,6 +159,29 @@ For more information, try '--help'.
}
#[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
+
+ tip: a similar argument exists: '--config'
+
+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();
@@ -183,6 +206,30 @@ fn cargo_compile_manifest_path() {
}
#[cargo_test]
+fn cargo_compile_with_wrong_manifest_path_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 --path foo/Cargo.toml")
+ .cwd(p.root().parent().unwrap())
+ .with_stderr(
+ "\
+error: unexpected argument '--path' found
+
+ tip: a similar argument exists: '--manifest-path'
+
+Usage: cargo[EXE] build [OPTIONS]
+
+For more information, try '--help'.
+",
+ )
+ .with_status(1)
+ .run();
+}
+
+#[cargo_test]
fn chdir_gated() {
let p = project()
.file("Cargo.toml", &basic_bin_manifest("foo"))
@@ -222,6 +269,33 @@ fn cargo_compile_directory_not_cwd() {
}
#[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
+
+ tip: a similar argument exists: '-Z'
+
+Usage: cargo [..][OPTIONS] [COMMAND]
+ cargo [..][OPTIONS] -Zscript <MANIFEST_RS> [ARGS]...
+
+For more information, try '--help'.
+",
+ )
+ .with_status(1)
+ .run();
+}
+
+#[cargo_test]
fn cargo_compile_directory_not_cwd_with_invalid_config() {
let p = project()
.file("Cargo.toml", &basic_bin_manifest("foo"))
@@ -465,7 +539,7 @@ fn cargo_compile_with_forbidden_bin_target_name() {
[ERROR] failed to parse manifest at `[..]`
Caused by:
- the binary target name `build` is forbidden, it conflicts with with cargo's build directory names
+ the binary target name `build` is forbidden, it conflicts with cargo's build directory names
",
)
.run();
@@ -4190,6 +4264,30 @@ fn cargo_build_empty_target() {
}
#[cargo_test]
+fn cargo_build_with_unsupported_short_target_flag() {
+ let p = project()
+ .file("Cargo.toml", &basic_bin_manifest("foo"))
+ .file("src/main.rs", "fn main() {}")
+ .build();
+
+ p.cargo("build -t")
+ .arg("")
+ .with_stderr(
+ "\
+error: unexpected argument '-t' found
+
+ tip: a similar argument exists: '--target'
+
+Usage: cargo[EXE] build [OPTIONS]
+
+For more information, try '--help'.
+",
+ )
+ .with_status(1)
+ .run();
+}
+
+#[cargo_test]
fn build_all_workspace() {
let p = project()
.file(
@@ -4255,6 +4353,43 @@ fn build_all_exclude() {
}
#[cargo_test]
+fn cargo_build_with_unsupported_short_exclude_flag() {
+ let p = project()
+ .file(
+ "Cargo.toml",
+ r#"
+ [package]
+ name = "foo"
+ version = "0.1.0"
+
+ [workspace]
+ members = ["bar", "baz"]
+ "#,
+ )
+ .file("src/main.rs", "fn main() {}")
+ .file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
+ .file("bar/src/lib.rs", "pub fn bar() {}")
+ .file("baz/Cargo.toml", &basic_manifest("baz", "0.1.0"))
+ .file("baz/src/lib.rs", "pub fn baz() { break_the_build(); }")
+ .build();
+
+ p.cargo("build --workspace -x baz")
+ .with_stderr(
+ "\
+error: unexpected argument '-x' found
+
+ tip: a similar argument exists: '--exclude'
+
+Usage: cargo[EXE] build [OPTIONS]
+
+For more information, try '--help'.
+",
+ )
+ .with_status(1)
+ .run();
+}
+
+#[cargo_test]
fn build_all_exclude_not_found() {
let p = project()
.file(