Skip to content

Commit

Permalink
Only expect .path on 1.51
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Gjengset committed Jan 11, 2021
1 parent 9e176b7 commit 9610e70
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions tests/test_samples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ extern crate semver;
extern crate serde_json;

use cargo_metadata::{CargoOpt, DependencyKind, Metadata, MetadataCommand};
use std::path::{Path, PathBuf};
use std::path::PathBuf;

#[test]
fn old_minimal() {
Expand Down Expand Up @@ -225,13 +225,15 @@ fn all_the_fields() {
assert_eq!(path_dep.source, None);
assert_eq!(path_dep.kind, DependencyKind::Normal);
assert_eq!(path_dep.req, semver::VersionReq::parse("*").unwrap());
assert_eq!(
path_dep
.path
.as_deref()
.map(|p| p.ends_with("path-dep/Cargo.toml")),
Some(true),
);
if ver >= semver::Version::parse("1.51.0").unwrap() {
assert_eq!(
path_dep
.path
.as_ref()
.map(|p| p.ends_with("path-dep/Cargo.toml")),
Some(true),
);
}

all.dependencies
.iter()
Expand Down

0 comments on commit 9610e70

Please sign in to comment.