Skip to content

Commit

Permalink
Merge pull request #173 from ehuss/fix-1.60-tests
Browse files Browse the repository at this point in the history
Fix tests due to changes since 1.60
  • Loading branch information
oli-obk authored Feb 15, 2022
2 parents 06a5cf9 + 4c85f5a commit d772fd3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion tests/all/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ feat1 = []
feat2 = []

[lib]
crate-type = ["rlib", "cdylib", "dylib", "staticlib"]
crate-type = ["rlib", "cdylib", "staticlib"]

[[bin]]
name = "otherbin"
Expand Down
17 changes: 10 additions & 7 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 @@ -291,13 +291,10 @@ fn all_the_fields() {
assert_eq!(all.targets.len(), 8);
let lib = get_file_name!("lib.rs");
assert_eq!(lib.name, "all");
assert_eq!(
sorted!(lib.kind),
vec!["cdylib", "dylib", "rlib", "staticlib"]
);
assert_eq!(sorted!(lib.kind), vec!["cdylib", "rlib", "staticlib"]);
assert_eq!(
sorted!(lib.crate_types),
vec!["cdylib", "dylib", "rlib", "staticlib"]
vec!["cdylib", "rlib", "staticlib"]
);
assert_eq!(lib.required_features.len(), 0);
assert_eq!(lib.edition, "2018");
Expand Down Expand Up @@ -332,7 +329,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 d772fd3

Please sign in to comment.