test: migrate inheritable_workspace_fields to snapbox

This commit is contained in:
eth3lbert 2024-06-29 10:16:49 +08:00
parent bff8a08165
commit fceb9d3a75
No known key found for this signature in database

View File

@ -1,9 +1,9 @@
//! Tests for inheriting Cargo.toml fields with field.workspace = true //! Tests for inheriting Cargo.toml fields with field.workspace = true
#![allow(deprecated)]
use cargo_test_support::prelude::*;
use cargo_test_support::registry::{Dependency, Package, RegistryBuilder}; use cargo_test_support::registry::{Dependency, Package, RegistryBuilder};
use cargo_test_support::{ use cargo_test_support::{
basic_lib_manifest, basic_manifest, git, path2url, paths, project, publish, registry, basic_lib_manifest, basic_manifest, git, paths, project, publish, registry, str,
}; };
#[cargo_test] #[cargo_test]
@ -52,12 +52,11 @@ fn permit_additional_workspace_fields() {
p.cargo("check") p.cargo("check")
// Should not warn about unused fields. // Should not warn about unused fields.
.with_stderr( .with_stderr_data(str![[r#"
"\ [CHECKING] bar v0.1.0 ([ROOT]/foo/bar)
[CHECKING] bar v0.1.0 ([CWD]/bar) [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
", "#]])
)
.run(); .run();
p.cargo("check").run(); p.cargo("check").run();
@ -95,14 +94,13 @@ fn deny_optional_dependencies() {
p.cargo("check") p.cargo("check")
.with_status(101) .with_status(101)
.with_stderr( .with_stderr_data(str![[r#"
"\ [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml`
[ERROR] failed to parse manifest at `[..]foo/Cargo.toml`
Caused by: Caused by:
dep1 is optional, but workspace dependencies cannot be optional dep1 is optional, but workspace dependencies cannot be optional
",
) "#]])
.run(); .run();
} }
@ -159,22 +157,21 @@ fn inherit_own_workspace_fields() {
p.cargo("publish") p.cargo("publish")
.replace_crates_io(registry.index_url()) .replace_crates_io(registry.index_url())
.with_stderr( .with_stderr_data(str![[r#"
"\ [UPDATING] crates.io index
[UPDATING] [..] [WARNING] both package.include and package.exclude are specified; the exclude list will be ignored
[WARNING] [..] [PACKAGING] foo v1.2.3 ([ROOT]/foo)
[..] [PACKAGED] 6 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
[PACKAGED] [..] [VERIFYING] foo v1.2.3 ([ROOT]/foo)
[VERIFYING] foo v1.2.3 [..] [COMPILING] foo v1.2.3 ([ROOT]/foo/target/package/foo-1.2.3)
[COMPILING] foo v1.2.3 [..] [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
[FINISHED] [..] [UPLOADING] foo v1.2.3 ([ROOT]/foo)
[UPLOADING] foo v1.2.3 [..]
[UPLOADED] foo v1.2.3 to registry `crates-io` [UPLOADED] foo v1.2.3 to registry `crates-io`
[NOTE] waiting for `foo v1.2.3` to be available at registry `crates-io`. [NOTE] waiting for `foo v1.2.3` to be available at registry `crates-io`.
You may press ctrl-c to skip waiting; the crate should be available shortly. You may press ctrl-c to skip waiting; the crate should be available shortly.
[PUBLISHED] foo v1.2.3 at registry `crates-io` [PUBLISHED] foo v1.2.3 at registry `crates-io`
",
) "#]])
.run(); .run();
publish::validate_upload_with_contents( publish::validate_upload_with_contents(
@ -290,17 +287,19 @@ fn inherit_own_dependencies() {
p.cargo("check") p.cargo("check")
// Unordered because the download order is nondeterministic. // Unordered because the download order is nondeterministic.
.with_stderr_unordered( .with_stderr_data(
"\ str![[r#"
[UPDATING] `[..]` index [UPDATING] `dummy-registry` index
[LOCKING] 4 packages to latest compatible versions [LOCKING] 4 packages to latest compatible versions
[DOWNLOADING] crates ... [DOWNLOADING] crates ...
[DOWNLOADED] dep v0.1.2 ([..]) [DOWNLOADED] dep v0.1.2 (registry `dummy-registry`)
[DOWNLOADED] dep-build v0.8.2 ([..]) [DOWNLOADED] dep-build v0.8.2 (registry `dummy-registry`)
[CHECKING] dep v0.1.2 [CHECKING] dep v0.1.2
[CHECKING] bar v0.2.0 ([CWD]) [CHECKING] bar v0.2.0 ([ROOT]/foo)
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..] [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
",
"#]]
.unordered(),
) )
.run(); .run();
@ -312,25 +311,24 @@ fn inherit_own_dependencies() {
p.cargo("publish") p.cargo("publish")
.replace_crates_io(registry.index_url()) .replace_crates_io(registry.index_url())
.with_stderr( .with_stderr_data(str![[r#"
"\ [UPDATING] crates.io index
[UPDATING] [..] [WARNING] manifest has no description, license, license-file, documentation, homepage or repository.
[WARNING] [..] See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.
[..] [PACKAGING] bar v0.2.0 ([ROOT]/foo)
[PACKAGING] bar v0.2.0 [..] [UPDATING] crates.io index
[UPDATING] [..] [PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
[PACKAGED] [..] [VERIFYING] bar v0.2.0 ([ROOT]/foo)
[VERIFYING] bar v0.2.0 [..]
[COMPILING] dep v0.1.2 [COMPILING] dep v0.1.2
[COMPILING] bar v0.2.0 [..] [COMPILING] bar v0.2.0 ([ROOT]/foo/target/package/bar-0.2.0)
[FINISHED] [..] [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
[UPLOADING] bar v0.2.0 [..] [UPLOADING] bar v0.2.0 ([ROOT]/foo)
[UPLOADED] bar v0.2.0 to registry `crates-io` [UPLOADED] bar v0.2.0 to registry `crates-io`
[NOTE] waiting for `bar v0.2.0` to be available at registry `crates-io`. [NOTE] waiting for `bar v0.2.0` to be available at registry `crates-io`.
You may press ctrl-c to skip waiting; the crate should be available shortly. You may press ctrl-c to skip waiting; the crate should be available shortly.
[PUBLISHED] bar v0.2.0 at registry `crates-io` [PUBLISHED] bar v0.2.0 at registry `crates-io`
",
) "#]])
.run(); .run();
publish::validate_upload_with_contents( publish::validate_upload_with_contents(
@ -452,17 +450,16 @@ fn inherit_own_detailed_dependencies() {
.publish(); .publish();
p.cargo("check") p.cargo("check")
.with_stderr( .with_stderr_data(str![[r#"
"\ [UPDATING] `dummy-registry` index
[UPDATING] `[..]` index
[LOCKING] 2 packages to latest compatible versions [LOCKING] 2 packages to latest compatible versions
[DOWNLOADING] crates ... [DOWNLOADING] crates ...
[DOWNLOADED] dep v0.1.2 ([..]) [DOWNLOADED] dep v0.1.2 (registry `dummy-registry`)
[CHECKING] dep v0.1.2 [CHECKING] dep v0.1.2
[CHECKING] bar v0.2.0 ([CWD]) [CHECKING] bar v0.2.0 ([ROOT]/foo)
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..] [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
",
) "#]])
.run(); .run();
p.cargo("check").run(); p.cargo("check").run();
@ -471,25 +468,24 @@ fn inherit_own_detailed_dependencies() {
p.cargo("publish") p.cargo("publish")
.replace_crates_io(registry.index_url()) .replace_crates_io(registry.index_url())
.with_stderr( .with_stderr_data(str![[r#"
"\ [UPDATING] crates.io index
[UPDATING] [..] [WARNING] manifest has no description, license, license-file, documentation, homepage or repository.
[WARNING] [..] See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.
[..] [PACKAGING] bar v0.2.0 ([ROOT]/foo)
[PACKAGING] bar v0.2.0 [..] [UPDATING] crates.io index
[UPDATING] [..] [PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
[PACKAGED] [..] [VERIFYING] bar v0.2.0 ([ROOT]/foo)
[VERIFYING] bar v0.2.0 [..]
[COMPILING] dep v0.1.2 [COMPILING] dep v0.1.2
[COMPILING] bar v0.2.0 [..] [COMPILING] bar v0.2.0 ([ROOT]/foo/target/package/bar-0.2.0)
[FINISHED] [..] [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
[UPLOADING] bar v0.2.0 [..] [UPLOADING] bar v0.2.0 ([ROOT]/foo)
[UPLOADED] bar v0.2.0 to registry `crates-io` [UPLOADED] bar v0.2.0 to registry `crates-io`
[NOTE] waiting for `bar v0.2.0` to be available at registry `crates-io`. [NOTE] waiting for `bar v0.2.0` to be available at registry `crates-io`.
You may press ctrl-c to skip waiting; the crate should be available shortly. You may press ctrl-c to skip waiting; the crate should be available shortly.
[PUBLISHED] bar v0.2.0 at registry `crates-io` [PUBLISHED] bar v0.2.0 at registry `crates-io`
",
) "#]])
.run(); .run();
publish::validate_upload_with_contents( publish::validate_upload_with_contents(
@ -583,17 +579,16 @@ fn inherit_from_own_undefined_field() {
p.cargo("check") p.cargo("check")
.with_status(101) .with_status(101)
.with_stderr( .with_stderr_data(str![[r#"
"\ [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml`
[ERROR] failed to parse manifest at `[CWD]/Cargo.toml`
Caused by: Caused by:
error inheriting `description` from workspace root manifest's `workspace.package.description` error inheriting `description` from workspace root manifest's `workspace.package.description`
Caused by: Caused by:
`workspace.package.description` was not defined `workspace.package.description` was not defined
",
) "#]])
.run(); .run();
} }
@ -632,20 +627,22 @@ fn inherited_dependencies_union_features() {
.build(); .build();
p.cargo("check") p.cargo("check")
.with_stderr( .with_stderr_data(
"\ str![[r#"
[UPDATING] `[..]` index [UPDATING] `dummy-registry` index
[LOCKING] 4 packages to latest compatible versions [LOCKING] 4 packages to latest compatible versions
[DOWNLOADING] crates ... [DOWNLOADING] crates ...
[DOWNLOADED] fancy_dep v0.2.4 ([..]) [DOWNLOADED] fancy_dep v0.2.4 (registry `dummy-registry`)
[DOWNLOADED] dep v0.1.0 ([..]) [DOWNLOADED] dep v0.1.0 (registry `dummy-registry`)
[DOWNLOADED] dancy_dep v0.6.8 ([..]) [DOWNLOADED] dancy_dep v0.6.8 (registry `dummy-registry`)
[CHECKING] [..] [CHECKING] fancy_dep v0.2.4
[CHECKING] [..] [CHECKING] dancy_dep v0.6.8
[CHECKING] dep v0.1.0 [CHECKING] dep v0.1.0
[CHECKING] bar v0.2.0 ([CWD]) [CHECKING] bar v0.2.0 ([ROOT]/foo)
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..] [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
",
"#]]
.unordered(),
) )
.run(); .run();
@ -721,26 +718,25 @@ fn inherit_workspace_fields() {
p.cargo("publish") p.cargo("publish")
.replace_crates_io(registry.index_url()) .replace_crates_io(registry.index_url())
.cwd("bar") .cwd("bar")
.with_stderr( .with_stderr_data(str![[r#"
"\ [UPDATING] crates.io index
[UPDATING] [..] [WARNING] both package.include and package.exclude are specified; the exclude list will be ignored
[WARNING] [..] [PACKAGING] bar v1.2.3 ([ROOT]/foo/bar)
[..] [PACKAGED] 8 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
[PACKAGED] [..] [VERIFYING] bar v1.2.3 ([ROOT]/foo/bar)
[VERIFYING] bar v1.2.3 [..] [WARNING] only one of `license` or `license-file` is necessary
[WARNING] [..] `license` should be used if the package license can be expressed with a standard SPDX expression.
[..] `license-file` should be used if the package uses a non-standard license.
[..] See https://doc.rust-lang.org/cargo/reference/manifest.html#the-license-and-license-file-fields for more information.
[..] [COMPILING] bar v1.2.3 ([ROOT]/foo/target/package/bar-1.2.3)
[COMPILING] bar v1.2.3 [..] [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
[FINISHED] [..] [UPLOADING] bar v1.2.3 ([ROOT]/foo/bar)
[UPLOADING] bar v1.2.3 [..]
[UPLOADED] bar v1.2.3 to registry `crates-io` [UPLOADED] bar v1.2.3 to registry `crates-io`
[NOTE] waiting for `bar v1.2.3` to be available at registry `crates-io`. [NOTE] waiting for `bar v1.2.3` to be available at registry `crates-io`.
You may press ctrl-c to skip waiting; the crate should be available shortly. You may press ctrl-c to skip waiting; the crate should be available shortly.
[PUBLISHED] bar v1.2.3 at registry `crates-io` [PUBLISHED] bar v1.2.3 at registry `crates-io`
",
) "#]])
.run(); .run();
publish::validate_upload_with_contents( publish::validate_upload_with_contents(
@ -862,17 +858,19 @@ fn inherit_dependencies() {
p.cargo("check") p.cargo("check")
// Unordered because the download order is nondeterministic. // Unordered because the download order is nondeterministic.
.with_stderr_unordered( .with_stderr_data(
"\ str![[r#"
[UPDATING] `[..]` index [UPDATING] `dummy-registry` index
[LOCKING] 4 packages to latest compatible versions [LOCKING] 4 packages to latest compatible versions
[DOWNLOADING] crates ... [DOWNLOADING] crates ...
[DOWNLOADED] dep v0.1.2 ([..]) [DOWNLOADED] dep v0.1.2 (registry `dummy-registry`)
[DOWNLOADED] dep-build v0.8.2 ([..]) [DOWNLOADED] dep-build v0.8.2 (registry `dummy-registry`)
[CHECKING] dep v0.1.2 [CHECKING] dep v0.1.2
[CHECKING] bar v0.2.0 ([CWD]/bar) [CHECKING] bar v0.2.0 ([ROOT]/foo/bar)
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..] [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
",
"#]]
.unordered(),
) )
.run(); .run();
@ -885,25 +883,24 @@ fn inherit_dependencies() {
p.cargo("publish") p.cargo("publish")
.replace_crates_io(registry.index_url()) .replace_crates_io(registry.index_url())
.cwd("bar") .cwd("bar")
.with_stderr( .with_stderr_data(str![[r#"
"\ [UPDATING] crates.io index
[UPDATING] [..] [WARNING] manifest has no description, license, license-file, documentation, homepage or repository.
[WARNING] [..] See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.
[..] [PACKAGING] bar v0.2.0 ([ROOT]/foo/bar)
[PACKAGING] bar v0.2.0 [..] [UPDATING] crates.io index
[UPDATING] [..] [PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
[PACKAGED] [..] [VERIFYING] bar v0.2.0 ([ROOT]/foo/bar)
[VERIFYING] bar v0.2.0 [..]
[COMPILING] dep v0.1.2 [COMPILING] dep v0.1.2
[COMPILING] bar v0.2.0 [..] [COMPILING] bar v0.2.0 ([ROOT]/foo/target/package/bar-0.2.0)
[FINISHED] [..] [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
[UPLOADING] bar v0.2.0 [..] [UPLOADING] bar v0.2.0 ([ROOT]/foo/bar)
[UPLOADED] bar v0.2.0 to registry `crates-io` [UPLOADED] bar v0.2.0 to registry `crates-io`
[NOTE] waiting for `bar v0.2.0` to be available at registry `crates-io`. [NOTE] waiting for `bar v0.2.0` to be available at registry `crates-io`.
You may press ctrl-c to skip waiting; the crate should be available shortly. You may press ctrl-c to skip waiting; the crate should be available shortly.
[PUBLISHED] bar v0.2.0 at registry `crates-io` [PUBLISHED] bar v0.2.0 at registry `crates-io`
",
) "#]])
.run(); .run();
publish::validate_upload_with_contents( publish::validate_upload_with_contents(
@ -1027,17 +1024,16 @@ fn inherit_target_dependencies() {
Package::new("dep", "0.1.2").publish(); Package::new("dep", "0.1.2").publish();
p.cargo("check") p.cargo("check")
.with_stderr( .with_stderr_data(str![[r#"
"\ [UPDATING] `dummy-registry` index
[UPDATING] `[..]` index
[LOCKING] 2 packages to latest compatible versions [LOCKING] 2 packages to latest compatible versions
[DOWNLOADING] crates ... [DOWNLOADING] crates ...
[DOWNLOADED] dep v0.1.2 ([..]) [DOWNLOADED] dep v0.1.2 (registry `dummy-registry`)
[CHECKING] dep v0.1.2 [CHECKING] dep v0.1.2
[CHECKING] bar v0.2.0 ([CWD]/bar) [CHECKING] bar v0.2.0 ([ROOT]/foo/bar)
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..] [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
",
) "#]])
.run(); .run();
let lockfile = p.read_lockfile(); let lockfile = p.read_lockfile();
@ -1075,14 +1071,13 @@ fn inherit_dependency_override_optional() {
.build(); .build();
p.cargo("check") p.cargo("check")
.with_stderr( .with_stderr_data(str![[r#"
"\ [UPDATING] `dummy-registry` index
[UPDATING] `[..]` index
[LOCKING] 2 packages to latest compatible versions [LOCKING] 2 packages to latest compatible versions
[CHECKING] bar v0.2.0 ([CWD]/bar) [CHECKING] bar v0.2.0 ([ROOT]/foo/bar)
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..] [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
",
) "#]])
.run(); .run();
} }
@ -1119,19 +1114,18 @@ fn inherit_dependency_features() {
.build(); .build();
p.cargo("check") p.cargo("check")
.with_stderr( .with_stderr_data(str![[r#"
"\ [UPDATING] `dummy-registry` index
[UPDATING] `[..]` index
[LOCKING] 3 packages to latest compatible versions [LOCKING] 3 packages to latest compatible versions
[DOWNLOADING] crates ... [DOWNLOADING] crates ...
[DOWNLOADED] fancy_dep v0.2.4 ([..]) [DOWNLOADED] fancy_dep v0.2.4 (registry `dummy-registry`)
[DOWNLOADED] dep v0.1.0 ([..]) [DOWNLOADED] dep v0.1.0 (registry `dummy-registry`)
[CHECKING] fancy_dep v0.2.4 [CHECKING] fancy_dep v0.2.4
[CHECKING] dep v0.1.0 [CHECKING] dep v0.1.0
[CHECKING] bar v0.2.0 ([CWD]) [CHECKING] bar v0.2.0 ([ROOT]/foo)
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..] [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
",
) "#]])
.run(); .run();
let lockfile = p.read_lockfile(); let lockfile = p.read_lockfile();
@ -1189,19 +1183,15 @@ fn inherit_detailed_dependencies() {
.file("bar/src/main.rs", "fn main() {}") .file("bar/src/main.rs", "fn main() {}")
.build(); .build();
let git_root = git_project.root();
p.cargo("check") p.cargo("check")
.with_stderr(&format!( .with_stderr_data(str![[r#"
"\ [UPDATING] git repository `[ROOTURL]/detailed`
[UPDATING] git repository `{}`\n\
[LOCKING] 2 packages to latest compatible versions [LOCKING] 2 packages to latest compatible versions
[CHECKING] detailed v0.5.0 ({}?branch=branchy#[..])\n\ [CHECKING] detailed v0.5.0 ([ROOTURL]/detailed?branch=branchy#[..])
[CHECKING] bar v0.2.0 ([CWD]/bar)\n\ [CHECKING] bar v0.2.0 ([ROOT]/foo/bar)
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]\n", [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
path2url(&git_root),
path2url(&git_root), "#]])
))
.run(); .run();
} }
@ -1236,14 +1226,13 @@ fn inherit_path_dependencies() {
.build(); .build();
p.cargo("check") p.cargo("check")
.with_stderr( .with_stderr_data(str![[r#"
"\
[LOCKING] 2 packages to latest compatible versions [LOCKING] 2 packages to latest compatible versions
[CHECKING] dep v0.9.0 ([CWD]/dep) [CHECKING] dep v0.9.0 ([ROOT]/foo/dep)
[CHECKING] bar v0.2.0 ([CWD]/bar) [CHECKING] bar v0.2.0 ([ROOT]/foo/bar)
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..] [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
",
) "#]])
.run(); .run();
let lockfile = p.read_lockfile(); let lockfile = p.read_lockfile();
@ -1283,16 +1272,15 @@ fn error_workspace_false() {
p.cargo("check") p.cargo("check")
.cwd("bar") .cwd("bar")
.with_status(101) .with_status(101)
.with_stderr( .with_stderr_data(str![[r#"
"\
[ERROR] `workspace` cannot be false [ERROR] `workspace` cannot be false
--> Cargo.toml:8:41 --> Cargo.toml:8:41
| |
8 | description = { workspace = false } 8 | description = { workspace = false }
| ^^^^^ | ^^^^^
| |
",
) "#]])
.run(); .run();
} }
@ -1327,14 +1315,13 @@ fn error_workspace_dependency_looked_for_workspace_itself() {
p.cargo("check") p.cargo("check")
.with_status(101) .with_status(101)
.with_stderr( .with_stderr_data(str![[r#"
"\ [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml`
[ERROR] failed to parse manifest at `[CWD]/Cargo.toml`
Caused by: Caused by:
dependency (dep) specified without providing a local path, Git repository, version, or workspace dependency to use dependency (dep) specified without providing a local path, Git repository, version, or workspace dependency to use
",
) "#]])
.run(); .run();
} }
@ -1370,8 +1357,7 @@ fn error_malformed_workspace_root() {
p.cargo("check") p.cargo("check")
.cwd("bar") .cwd("bar")
.with_status(101) .with_status(101)
.with_stderr( .with_stderr_data(str![[r#"
"\
[ERROR] invalid array [ERROR] invalid array
expected `]` expected `]`
--> ../Cargo.toml:3:24 --> ../Cargo.toml:3:24
@ -1379,8 +1365,8 @@ expected `]`
3 | members = [invalid toml 3 | members = [invalid toml
| ^ | ^
| |
",
) "#]])
.run(); .run();
} }
@ -1410,17 +1396,16 @@ fn error_no_root_workspace() {
p.cargo("check") p.cargo("check")
.cwd("bar") .cwd("bar")
.with_status(101) .with_status(101)
.with_stderr( .with_stderr_data(str![[r#"
"\ [ERROR] failed to parse manifest at `[ROOT]/foo/bar/Cargo.toml`
[ERROR] failed to parse manifest at `[..]/Cargo.toml`
Caused by: Caused by:
error inheriting `description` from workspace root manifest's `workspace.package.description` error inheriting `description` from workspace root manifest's `workspace.package.description`
Caused by: Caused by:
root of a workspace inferred but wasn't a root: [..]/Cargo.toml root of a workspace inferred but wasn't a root: [ROOT]/foo/Cargo.toml
",
) "#]])
.run(); .run();
} }
@ -1456,17 +1441,16 @@ fn error_inherit_unspecified_dependency() {
p.cargo("check") p.cargo("check")
.cwd("bar") .cwd("bar")
.with_status(101) .with_status(101)
.with_stderr( .with_stderr_data(str![[r#"
"\ [ERROR] failed to parse manifest at `[ROOT]/foo/bar/Cargo.toml`
[ERROR] failed to parse manifest at `[CWD]/Cargo.toml`
Caused by: Caused by:
error inheriting `foo` from workspace root manifest's `workspace.dependencies.foo` error inheriting `foo` from workspace root manifest's `workspace.dependencies.foo`
Caused by: Caused by:
`workspace.dependencies` was not defined `workspace.dependencies` was not defined
",
) "#]])
.run(); .run();
} }
@ -1501,23 +1485,19 @@ fn warn_inherit_def_feat_true_member_def_feat_false() {
.file("src/main.rs", "fn main() {}") .file("src/main.rs", "fn main() {}")
.build(); .build();
p.cargo("check") p.cargo("check").with_stderr_data(str![[r#"
.with_stderr( [WARNING] [ROOT]/foo/Cargo.toml: `default-features` is ignored for dep, since `default-features` was true for `workspace.dependencies.dep`, this could become a hard error in the future
"\
[WARNING] [CWD]/Cargo.toml: `default-features` is ignored for dep, since `default-features` was \
true for `workspace.dependencies.dep`, this could become a hard error in the future
[UPDATING] `dummy-registry` index [UPDATING] `dummy-registry` index
[LOCKING] 3 packages to latest compatible versions [LOCKING] 3 packages to latest compatible versions
[DOWNLOADING] crates ... [DOWNLOADING] crates ...
[DOWNLOADED] fancy_dep v0.2.4 ([..]) [DOWNLOADED] fancy_dep v0.2.4 (registry `dummy-registry`)
[DOWNLOADED] dep v0.1.0 ([..]) [DOWNLOADED] dep v0.1.0 (registry `dummy-registry`)
[CHECKING] fancy_dep v0.2.4 [CHECKING] fancy_dep v0.2.4
[CHECKING] dep v0.1.0 [CHECKING] dep v0.1.0
[CHECKING] bar v0.2.0 ([CWD]) [CHECKING] bar v0.2.0 ([ROOT]/foo)
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..] [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
",
) "#]]).run();
.run();
} }
#[cargo_test(nightly, reason = "edition2024 is not stable")] #[cargo_test(nightly, reason = "edition2024 is not stable")]
@ -1556,17 +1536,16 @@ fn warn_inherit_def_feat_true_member_def_feat_false_2024_edition() {
p.cargo("check") p.cargo("check")
.masquerade_as_nightly_cargo(&["edition2024"]) .masquerade_as_nightly_cargo(&["edition2024"])
.with_status(101) .with_status(101)
.with_stderr( .with_stderr_data(str![[r#"
"\ [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml`
[ERROR] failed to parse manifest at `[CWD]/Cargo.toml`
Caused by: Caused by:
error inheriting `dep` from workspace root manifest's `workspace.dependencies.dep` error inheriting `dep` from workspace root manifest's `workspace.dependencies.dep`
Caused by: Caused by:
`default-features = false` cannot override workspace's `default-features` `default-features = false` cannot override workspace's `default-features`
",
) "#]])
.run(); .run();
} }
@ -1601,23 +1580,19 @@ fn warn_inherit_simple_member_def_feat_false() {
.file("src/main.rs", "fn main() {}") .file("src/main.rs", "fn main() {}")
.build(); .build();
p.cargo("check") p.cargo("check").with_stderr_data(str![[r#"
.with_stderr( [WARNING] [ROOT]/foo/Cargo.toml: `default-features` is ignored for dep, since `default-features` was not specified for `workspace.dependencies.dep`, this could become a hard error in the future
"\
[WARNING] [CWD]/Cargo.toml: `default-features` is ignored for dep, since `default-features` was \
not specified for `workspace.dependencies.dep`, this could become a hard error in the future
[UPDATING] `dummy-registry` index [UPDATING] `dummy-registry` index
[LOCKING] 3 packages to latest compatible versions [LOCKING] 3 packages to latest compatible versions
[DOWNLOADING] crates ... [DOWNLOADING] crates ...
[DOWNLOADED] fancy_dep v0.2.4 ([..]) [DOWNLOADED] fancy_dep v0.2.4 (registry `dummy-registry`)
[DOWNLOADED] dep v0.1.0 ([..]) [DOWNLOADED] dep v0.1.0 (registry `dummy-registry`)
[CHECKING] fancy_dep v0.2.4 [CHECKING] fancy_dep v0.2.4
[CHECKING] dep v0.1.0 [CHECKING] dep v0.1.0
[CHECKING] bar v0.2.0 ([CWD]) [CHECKING] bar v0.2.0 ([ROOT]/foo)
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..] [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
",
) "#]]).run();
.run();
} }
#[cargo_test(nightly, reason = "edition2024 is not stable")] #[cargo_test(nightly, reason = "edition2024 is not stable")]
@ -1656,17 +1631,16 @@ fn warn_inherit_simple_member_def_feat_false_2024_edition() {
p.cargo("check") p.cargo("check")
.masquerade_as_nightly_cargo(&["edition2024"]) .masquerade_as_nightly_cargo(&["edition2024"])
.with_status(101) .with_status(101)
.with_stderr( .with_stderr_data(str![[r#"
"\ [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml`
[ERROR] failed to parse manifest at `[CWD]/Cargo.toml`
Caused by: Caused by:
error inheriting `dep` from workspace root manifest's `workspace.dependencies.dep` error inheriting `dep` from workspace root manifest's `workspace.dependencies.dep`
Caused by: Caused by:
`default-features = false` cannot override workspace's `default-features` `default-features = false` cannot override workspace's `default-features`
",
) "#]])
.run(); .run();
} }
@ -1702,19 +1676,18 @@ fn inherit_def_feat_false_member_def_feat_true() {
.build(); .build();
p.cargo("check") p.cargo("check")
.with_stderr( .with_stderr_data(str![[r#"
"\
[UPDATING] `dummy-registry` index [UPDATING] `dummy-registry` index
[LOCKING] 3 packages to latest compatible versions [LOCKING] 3 packages to latest compatible versions
[DOWNLOADING] crates ... [DOWNLOADING] crates ...
[DOWNLOADED] fancy_dep v0.2.4 ([..]) [DOWNLOADED] fancy_dep v0.2.4 (registry `dummy-registry`)
[DOWNLOADED] dep v0.1.0 ([..]) [DOWNLOADED] dep v0.1.0 (registry `dummy-registry`)
[CHECKING] fancy_dep v0.2.4 [CHECKING] fancy_dep v0.2.4
[CHECKING] dep v0.1.0 [CHECKING] dep v0.1.0
[CHECKING] bar v0.2.0 ([CWD]) [CHECKING] bar v0.2.0 ([ROOT]/foo)
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..] [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
",
) "#]])
.run(); .run();
} }
@ -1750,14 +1723,13 @@ fn cannot_inherit_in_patch() {
p.cargo("check") p.cargo("check")
.with_status(101) .with_status(101)
.with_stderr( .with_stderr_data(str![[r#"
"\ [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml`
[ERROR] failed to parse manifest at `[CWD]/Cargo.toml`
Caused by: Caused by:
dependency (bar) specified without providing a local path, Git repository, version, or workspace dependency to use dependency (bar) specified without providing a local path, Git repository, version, or workspace dependency to use
",
) "#]])
.run(); .run();
} }
@ -1788,19 +1760,18 @@ fn warn_inherit_unused_manifest_key_dep() {
.build(); .build();
p.cargo("check") p.cargo("check")
.with_stderr( .with_stderr_data(str![[r#"
"\ [WARNING] [ROOT]/foo/Cargo.toml: unused manifest key: workspace.dependencies.dep.wxz
[WARNING] [CWD]/Cargo.toml: unused manifest key: workspace.dependencies.dep.wxz [WARNING] [ROOT]/foo/Cargo.toml: unused manifest key: dependencies.dep.wxz
[WARNING] [CWD]/Cargo.toml: unused manifest key: dependencies.dep.wxz [UPDATING] `dummy-registry` index
[UPDATING] `[..]` index
[LOCKING] 2 packages to latest compatible versions [LOCKING] 2 packages to latest compatible versions
[DOWNLOADING] crates ... [DOWNLOADING] crates ...
[DOWNLOADED] dep v0.1.0 ([..]) [DOWNLOADED] dep v0.1.0 (registry `dummy-registry`)
[CHECKING] [..] [CHECKING] dep v0.1.0
[CHECKING] bar v0.2.0 ([CWD]) [CHECKING] bar v0.2.0 ([ROOT]/foo)
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..] [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
",
) "#]])
.run(); .run();
} }
@ -1826,13 +1797,12 @@ fn warn_unused_workspace_package_field() {
.build(); .build();
p.cargo("check") p.cargo("check")
.with_stderr( .with_stderr_data(str![[r#"
"\ [WARNING] [ROOT]/foo/Cargo.toml: unused manifest key: workspace.package.name
[WARNING] [CWD]/Cargo.toml: unused manifest key: workspace.package.name [CHECKING] foo v0.0.0 ([ROOT]/foo)
[CHECKING] foo v0.0.0 ([CWD]) [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
", "#]])
)
.run(); .run();
} }
@ -1884,25 +1854,24 @@ fn warn_inherit_unused_manifest_key_package() {
.build(); .build();
p.cargo("check") p.cargo("check")
.with_stderr( .with_stderr_data(str![[r#"
"\ [WARNING] [ROOT]/foo/Cargo.toml: unused manifest key: package.authors.xyz
[WARNING] [CWD]/Cargo.toml: unused manifest key: package.authors.xyz [WARNING] [ROOT]/foo/Cargo.toml: unused manifest key: package.categories.xyz
[WARNING] [CWD]/Cargo.toml: unused manifest key: package.categories.xyz [WARNING] [ROOT]/foo/Cargo.toml: unused manifest key: package.description.xyz
[WARNING] [CWD]/Cargo.toml: unused manifest key: package.description.xyz [WARNING] [ROOT]/foo/Cargo.toml: unused manifest key: package.documentation.xyz
[WARNING] [CWD]/Cargo.toml: unused manifest key: package.documentation.xyz [WARNING] [ROOT]/foo/Cargo.toml: unused manifest key: package.edition.xyz
[WARNING] [CWD]/Cargo.toml: unused manifest key: package.edition.xyz [WARNING] [ROOT]/foo/Cargo.toml: unused manifest key: package.exclude.xyz
[WARNING] [CWD]/Cargo.toml: unused manifest key: package.exclude.xyz [WARNING] [ROOT]/foo/Cargo.toml: unused manifest key: package.homepage.xyz
[WARNING] [CWD]/Cargo.toml: unused manifest key: package.homepage.xyz [WARNING] [ROOT]/foo/Cargo.toml: unused manifest key: package.include.xyz
[WARNING] [CWD]/Cargo.toml: unused manifest key: package.include.xyz [WARNING] [ROOT]/foo/Cargo.toml: unused manifest key: package.keywords.xyz
[WARNING] [CWD]/Cargo.toml: unused manifest key: package.keywords.xyz [WARNING] [ROOT]/foo/Cargo.toml: unused manifest key: package.license.xyz
[WARNING] [CWD]/Cargo.toml: unused manifest key: package.license.xyz [WARNING] [ROOT]/foo/Cargo.toml: unused manifest key: package.publish.xyz
[WARNING] [CWD]/Cargo.toml: unused manifest key: package.publish.xyz [WARNING] [ROOT]/foo/Cargo.toml: unused manifest key: package.repository.xyz
[WARNING] [CWD]/Cargo.toml: unused manifest key: package.repository.xyz [WARNING] [ROOT]/foo/Cargo.toml: unused manifest key: package.rust-version.xyz
[WARNING] [CWD]/Cargo.toml: unused manifest key: package.rust-version.xyz [WARNING] [ROOT]/foo/Cargo.toml: unused manifest key: package.version.xyz
[WARNING] [CWD]/Cargo.toml: unused manifest key: package.version.xyz [CHECKING] bar v1.2.3 ([ROOT]/foo)
[CHECKING] bar v1.2.3 ([CWD]) [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
", "#]])
)
.run(); .run();
} }