Skip to content

Commit 4cc8283

Browse files
committed
test(toml): Show default_features warning for workspace dependencies
1 parent c939267 commit 4cc8283

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed

tests/testsuite/bad_config.rs

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,6 +1355,90 @@ fn default_features2_conflict() {
13551355
.run();
13561356
}
13571357

1358+
#[cargo_test]
1359+
fn workspace_default_features2() {
1360+
let p = project()
1361+
.file(
1362+
"Cargo.toml",
1363+
r#"
1364+
[workspace]
1365+
members = ["workspace_only", "dep_workspace_only", "package_only", "dep_package_only"]
1366+
1367+
[workspace.dependencies]
1368+
dep_workspace_only = { path = "dep_workspace_only", default_features = true }
1369+
dep_package_only = { path = "dep_package_only" }
1370+
"#,
1371+
)
1372+
.file(
1373+
"workspace_only/Cargo.toml",
1374+
r#"
1375+
[package]
1376+
name = "workspace_only"
1377+
version = "0.1.0"
1378+
edition = "2015"
1379+
authors = []
1380+
1381+
[dependencies]
1382+
dep_workspace_only.workspace = true
1383+
"#,
1384+
)
1385+
.file("workspace_only/src/lib.rs", "")
1386+
.file(
1387+
"dep_workspace_only/Cargo.toml",
1388+
r#"
1389+
[package]
1390+
name = "dep_workspace_only"
1391+
version = "0.1.0"
1392+
edition = "2015"
1393+
authors = []
1394+
"#,
1395+
)
1396+
.file("dep_workspace_only/src/lib.rs", "")
1397+
.file(
1398+
"package_only/Cargo.toml",
1399+
r#"
1400+
[package]
1401+
name = "package_only"
1402+
version = "0.1.0"
1403+
edition = "2015"
1404+
authors = []
1405+
1406+
[dependencies]
1407+
dep_package_only = { workspace = true, default_features = true }
1408+
"#,
1409+
)
1410+
.file("package_only/src/lib.rs", "")
1411+
.file(
1412+
"dep_package_only/Cargo.toml",
1413+
r#"
1414+
[package]
1415+
name = "dep_package_only"
1416+
version = "0.1.0"
1417+
edition = "2015"
1418+
authors = []
1419+
"#,
1420+
)
1421+
.file("dep_package_only/src/lib.rs", "")
1422+
.build();
1423+
1424+
p.cargo("check")
1425+
.with_stderr_unordered(
1426+
"\
1427+
warning: [CWD]/workspace_only/Cargo.toml: `default_features` is deprecated in favor of `default-features` and will not work in the 2024 edition
1428+
(in the `dep_workspace_only` dependency)
1429+
warning: [CWD]/package_only/Cargo.toml: `default_features` is deprecated in favor of `default-features` and will not work in the 2024 edition
1430+
(in the `dep_package_only` dependency)
1431+
Locking 4 packages to latest compatible versions
1432+
Checking dep_package_only v0.1.0 ([CWD]/dep_package_only)
1433+
Checking dep_workspace_only v0.1.0 ([CWD]/dep_workspace_only)
1434+
Checking package_only v0.1.0 ([CWD]/package_only)
1435+
Checking workspace_only v0.1.0 ([CWD]/workspace_only)
1436+
Finished `dev` profile [unoptimized + debuginfo] target(s) in [..]s
1437+
"
1438+
)
1439+
.run();
1440+
}
1441+
13581442
#[cargo_test]
13591443
fn proc_macro2() {
13601444
let foo = project()

0 commit comments

Comments
 (0)