Skip to content

Commit

Permalink
Fix features table check as of 1.60.
Browse files Browse the repository at this point in the history
As part of namespaced features, optional dependencies now appear
as a feature in the features table: rust-lang/cargo#10269
  • Loading branch information
ehuss committed Feb 15, 2022
1 parent 1dcb1d2 commit 083947e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/test_samples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ struct TestObject {

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

assert_eq!(all.features.len(), 3);
if ver >= semver::Version::parse("1.60.0").unwrap() {
// 1.60 now reports optional dependencies within the features table
assert_eq!(all.features.len(), 4);
assert_eq!(all.features["bitflags"], vec!["dep:bitflags"]);
} else {
assert_eq!(all.features.len(), 3);
}
assert_eq!(all.features["feat1"].len(), 0);
assert_eq!(all.features["feat2"].len(), 0);
assert_eq!(sorted!(all.features["default"]), vec!["bitflags", "feat1"]);
Expand Down

0 comments on commit 083947e

Please sign in to comment.