diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-07 05:48:48 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-07 05:48:48 +0000 |
commit | ef24de24a82fe681581cc130f342363c47c0969a (patch) | |
tree | 0d494f7e1a38b95c92426f58fe6eaa877303a86c /src/tools/cargo/tests/testsuite/features.rs | |
parent | Releasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-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/features.rs')
-rw-r--r-- | src/tools/cargo/tests/testsuite/features.rs | 88 |
1 files changed, 87 insertions, 1 deletions
diff --git a/src/tools/cargo/tests/testsuite/features.rs b/src/tools/cargo/tests/testsuite/features.rs index 557fab14a..4b7455c37 100644 --- a/src/tools/cargo/tests/testsuite/features.rs +++ b/src/tools/cargo/tests/testsuite/features.rs @@ -36,6 +36,37 @@ Caused by: } #[cargo_test] +fn empty_feature_name() { + let p = project() + .file( + "Cargo.toml", + r#" + [package] + name = "foo" + version = "0.0.1" + authors = [] + + [features] + "" = [] + "#, + ) + .file("src/main.rs", "") + .build(); + + p.cargo("check") + .with_status(101) + .with_stderr( + "\ +[ERROR] failed to parse manifest at `[..]` + +Caused by: + feature name cannot be empty +", + ) + .run(); +} + +#[cargo_test] fn same_name() { // Feature with the same name as a dependency. let p = project() @@ -1144,6 +1175,61 @@ fn activating_feature_activates_dep() { } #[cargo_test] +fn activating_feature_does_not_activate_transitive_dev_dependency() { + let p = project() + .no_manifest() + .file( + "a/Cargo.toml", + r#" + [package] + name = "a" + version = "0.0.0" + edition = "2021" + + [features] + f = ["b/f"] + + [dependencies] + b = { path = "../b" } + "#, + ) + .file( + "b/Cargo.toml", + r#" + [package] + name = "b" + version = "0.0.0" + edition = "2021" + + [features] + f = ["c/f"] + + [dev-dependencies] + c = { path = "../c" } + "#, + ) + .file( + "c/Cargo.toml", + r#" + [package] + name = "c" + version = "0.0.0" + edition = "2021" + + [features] + f = [] + "#, + ) + .file("a/src/lib.rs", "") + .file("b/src/lib.rs", "") + .file("c/src/lib.rs", "compile_error!") + .build(); + + p.cargo("check --manifest-path a/Cargo.toml --features f") + .run(); +} + +#[cargo_test] fn dep_feature_in_cmd_line() { let p = project() .file( @@ -1990,7 +2076,7 @@ error: failed to parse manifest at `[ROOT]/foo/Cargo.toml` Caused by: invalid character `&` in feature `a&b` in package foo v0.1.0 ([ROOT]/foo), \ - characters must be Unicode XID characters, `+`, or `.` \ + characters must be Unicode XID characters, '-', `+`, or `.` \ (numbers, `+`, `-`, `_`, `.`, or most letters) ", ) |