Skip to content

Commit 083947e

Browse files
committed
Fix features table check as of 1.60.
As part of namespaced features, optional dependencies now appear as a feature in the features table: rust-lang/cargo#10269
1 parent 1dcb1d2 commit 083947e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

tests/test_samples.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ struct TestObject {
158158

159159
#[test]
160160
fn all_the_fields() {
161-
// All the fields currently generated as of 1.58. This tries to exercise as
161+
// All the fields currently generated as of 1.60. This tries to exercise as
162162
// much as possible.
163163
let ver = cargo_version();
164164
let minimum = semver::Version::parse("1.56.0").unwrap();
@@ -332,7 +332,13 @@ fn all_the_fields() {
332332
let build = get_file_name!("build.rs");
333333
assert_eq!(build.kind, vec!["custom-build"]);
334334

335-
assert_eq!(all.features.len(), 3);
335+
if ver >= semver::Version::parse("1.60.0").unwrap() {
336+
// 1.60 now reports optional dependencies within the features table
337+
assert_eq!(all.features.len(), 4);
338+
assert_eq!(all.features["bitflags"], vec!["dep:bitflags"]);
339+
} else {
340+
assert_eq!(all.features.len(), 3);
341+
}
336342
assert_eq!(all.features["feat1"].len(), 0);
337343
assert_eq!(all.features["feat2"].len(), 0);
338344
assert_eq!(sorted!(all.features["default"]), vec!["bitflags", "feat1"]);

0 commit comments

Comments
 (0)