Skip to content

Commit 2611f5c

Browse files
committed
Move namespaced features tests to a separate file.
1 parent 2f115a7 commit 2611f5c

File tree

3 files changed

+275
-271
lines changed

3 files changed

+275
-271
lines changed

tests/testsuite/features.rs

Lines changed: 0 additions & 271 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,277 +1353,6 @@ fn many_cli_features_comma_and_space_delimited() {
13531353
.run();
13541354
}
13551355

1356-
#[cargo_test]
1357-
fn namespaced_invalid_feature() {
1358-
let p = project()
1359-
.file(
1360-
"Cargo.toml",
1361-
r#"
1362-
cargo-features = ["namespaced-features"]
1363-
1364-
[project]
1365-
name = "foo"
1366-
version = "0.0.1"
1367-
authors = []
1368-
namespaced-features = true
1369-
1370-
[features]
1371-
bar = ["baz"]
1372-
"#,
1373-
)
1374-
.file("src/main.rs", "")
1375-
.build();
1376-
1377-
p.cargo("build")
1378-
.masquerade_as_nightly_cargo()
1379-
.with_status(101)
1380-
.with_stderr(
1381-
"\
1382-
[ERROR] failed to parse manifest at `[..]`
1383-
1384-
Caused by:
1385-
Feature `bar` includes `baz` which is not defined as a feature
1386-
",
1387-
)
1388-
.run();
1389-
}
1390-
1391-
#[cargo_test]
1392-
fn namespaced_invalid_dependency() {
1393-
let p = project()
1394-
.file(
1395-
"Cargo.toml",
1396-
r#"
1397-
cargo-features = ["namespaced-features"]
1398-
1399-
[project]
1400-
name = "foo"
1401-
version = "0.0.1"
1402-
authors = []
1403-
namespaced-features = true
1404-
1405-
[features]
1406-
bar = ["crate:baz"]
1407-
"#,
1408-
)
1409-
.file("src/main.rs", "")
1410-
.build();
1411-
1412-
p.cargo("build")
1413-
.masquerade_as_nightly_cargo()
1414-
.with_status(101)
1415-
.with_stderr(
1416-
"\
1417-
[ERROR] failed to parse manifest at `[..]`
1418-
1419-
Caused by:
1420-
Feature `bar` includes `crate:baz` which is not a known dependency
1421-
",
1422-
)
1423-
.run();
1424-
}
1425-
1426-
#[cargo_test]
1427-
fn namespaced_non_optional_dependency() {
1428-
let p = project()
1429-
.file(
1430-
"Cargo.toml",
1431-
r#"
1432-
cargo-features = ["namespaced-features"]
1433-
1434-
[project]
1435-
name = "foo"
1436-
version = "0.0.1"
1437-
authors = []
1438-
namespaced-features = true
1439-
1440-
[features]
1441-
bar = ["crate:baz"]
1442-
1443-
[dependencies]
1444-
baz = "0.1"
1445-
"#,
1446-
)
1447-
.file("src/main.rs", "")
1448-
.build();
1449-
1450-
p.cargo("build")
1451-
.masquerade_as_nightly_cargo()
1452-
.with_status(101)
1453-
.with_stderr(
1454-
"\
1455-
[ERROR] failed to parse manifest at `[..]`
1456-
1457-
Caused by:
1458-
Feature `bar` includes `crate:baz` which is not an optional dependency.
1459-
Consider adding `optional = true` to the dependency
1460-
",
1461-
)
1462-
.run();
1463-
}
1464-
1465-
#[cargo_test]
1466-
fn namespaced_implicit_feature() {
1467-
let p = project()
1468-
.file(
1469-
"Cargo.toml",
1470-
r#"
1471-
cargo-features = ["namespaced-features"]
1472-
1473-
[project]
1474-
name = "foo"
1475-
version = "0.0.1"
1476-
authors = []
1477-
namespaced-features = true
1478-
1479-
[features]
1480-
bar = ["baz"]
1481-
1482-
[dependencies]
1483-
baz = { version = "0.1", optional = true }
1484-
"#,
1485-
)
1486-
.file("src/main.rs", "fn main() {}")
1487-
.build();
1488-
1489-
p.cargo("build").masquerade_as_nightly_cargo().run();
1490-
}
1491-
1492-
#[cargo_test]
1493-
fn namespaced_shadowed_dep() {
1494-
let p = project()
1495-
.file(
1496-
"Cargo.toml",
1497-
r#"
1498-
cargo-features = ["namespaced-features"]
1499-
1500-
[project]
1501-
name = "foo"
1502-
version = "0.0.1"
1503-
authors = []
1504-
namespaced-features = true
1505-
1506-
[features]
1507-
baz = []
1508-
1509-
[dependencies]
1510-
baz = { version = "0.1", optional = true }
1511-
"#,
1512-
)
1513-
.file("src/main.rs", "fn main() {}")
1514-
.build();
1515-
1516-
p.cargo("build").masquerade_as_nightly_cargo().with_status(101).with_stderr(
1517-
"\
1518-
[ERROR] failed to parse manifest at `[..]`
1519-
1520-
Caused by:
1521-
Feature `baz` includes the optional dependency of the same name, but this is left implicit in the features included by this feature.
1522-
Consider adding `crate:baz` to this feature's requirements.
1523-
",
1524-
)
1525-
.run();
1526-
}
1527-
1528-
#[cargo_test]
1529-
fn namespaced_shadowed_non_optional() {
1530-
let p = project()
1531-
.file(
1532-
"Cargo.toml",
1533-
r#"
1534-
cargo-features = ["namespaced-features"]
1535-
1536-
[project]
1537-
name = "foo"
1538-
version = "0.0.1"
1539-
authors = []
1540-
namespaced-features = true
1541-
1542-
[features]
1543-
baz = []
1544-
1545-
[dependencies]
1546-
baz = "0.1"
1547-
"#,
1548-
)
1549-
.file("src/main.rs", "fn main() {}")
1550-
.build();
1551-
1552-
p.cargo("build").masquerade_as_nightly_cargo().with_status(101).with_stderr(
1553-
"\
1554-
[ERROR] failed to parse manifest at `[..]`
1555-
1556-
Caused by:
1557-
Feature `baz` includes the dependency of the same name, but this is left implicit in the features included by this feature.
1558-
Additionally, the dependency must be marked as optional to be included in the feature definition.
1559-
Consider adding `crate:baz` to this feature's requirements and marking the dependency as `optional = true`
1560-
",
1561-
)
1562-
.run();
1563-
}
1564-
1565-
#[cargo_test]
1566-
fn namespaced_implicit_non_optional() {
1567-
let p = project()
1568-
.file(
1569-
"Cargo.toml",
1570-
r#"
1571-
cargo-features = ["namespaced-features"]
1572-
1573-
[project]
1574-
name = "foo"
1575-
version = "0.0.1"
1576-
authors = []
1577-
namespaced-features = true
1578-
1579-
[features]
1580-
bar = ["baz"]
1581-
1582-
[dependencies]
1583-
baz = "0.1"
1584-
"#,
1585-
)
1586-
.file("src/main.rs", "fn main() {}")
1587-
.build();
1588-
1589-
p.cargo("build").masquerade_as_nightly_cargo().with_status(101).with_stderr(
1590-
"\
1591-
[ERROR] failed to parse manifest at `[..]`
1592-
1593-
Caused by:
1594-
Feature `bar` includes `baz` which is not defined as a feature.
1595-
A non-optional dependency of the same name is defined; consider adding `optional = true` to its definition
1596-
",
1597-
).run();
1598-
}
1599-
1600-
#[cargo_test]
1601-
fn namespaced_same_name() {
1602-
let p = project()
1603-
.file(
1604-
"Cargo.toml",
1605-
r#"
1606-
cargo-features = ["namespaced-features"]
1607-
1608-
[project]
1609-
name = "foo"
1610-
version = "0.0.1"
1611-
authors = []
1612-
namespaced-features = true
1613-
1614-
[features]
1615-
baz = ["crate:baz"]
1616-
1617-
[dependencies]
1618-
baz = { version = "0.1", optional = true }
1619-
"#,
1620-
)
1621-
.file("src/main.rs", "fn main() {}")
1622-
.build();
1623-
1624-
p.cargo("build").masquerade_as_nightly_cargo().run();
1625-
}
1626-
16271356
#[cargo_test]
16281357
fn only_dep_is_optional() {
16291358
Package::new("bar", "0.1.0").publish();

0 commit comments

Comments
 (0)