Skip to content

Commit d772fd3

Browse files
authored
Merge pull request #173 from ehuss/fix-1.60-tests
Fix tests due to changes since 1.60
2 parents 06a5cf9 + 4c85f5a commit d772fd3

2 files changed

Lines changed: 11 additions & 8 deletions

File tree

tests/all/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ feat1 = []
4444
feat2 = []
4545

4646
[lib]
47-
crate-type = ["rlib", "cdylib", "dylib", "staticlib"]
47+
crate-type = ["rlib", "cdylib", "staticlib"]
4848

4949
[[bin]]
5050
name = "otherbin"

tests/test_samples.rs

Lines changed: 10 additions & 7 deletions
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();
@@ -291,13 +291,10 @@ fn all_the_fields() {
291291
assert_eq!(all.targets.len(), 8);
292292
let lib = get_file_name!("lib.rs");
293293
assert_eq!(lib.name, "all");
294-
assert_eq!(
295-
sorted!(lib.kind),
296-
vec!["cdylib", "dylib", "rlib", "staticlib"]
297-
);
294+
assert_eq!(sorted!(lib.kind), vec!["cdylib", "rlib", "staticlib"]);
298295
assert_eq!(
299296
sorted!(lib.crate_types),
300-
vec!["cdylib", "dylib", "rlib", "staticlib"]
297+
vec!["cdylib", "rlib", "staticlib"]
301298
);
302299
assert_eq!(lib.required_features.len(), 0);
303300
assert_eq!(lib.edition, "2018");
@@ -332,7 +329,13 @@ fn all_the_fields() {
332329
let build = get_file_name!("build.rs");
333330
assert_eq!(build.kind, vec!["custom-build"]);
334331

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

0 commit comments

Comments
 (0)