Skip to content

Commit ff157ae

Browse files
committed
Improve tests
1 parent b7f03c6 commit ff157ae

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

clippy_utils/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "clippy_utils"
3-
version = "0.1.0"
4-
authors = ["The Rust Project Developers"]
3+
version = "0.1.51"
4+
authors = ["The Rust Clippy Developers"]
55
edition = "2018"
66

77
[dependencies]

tests/versioncheck.rs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,24 @@
22
use rustc_tools_util::VersionInfo;
33

44
#[test]
5-
fn check_that_clippy_lints_has_the_same_version_as_clippy() {
5+
fn check_that_clippy_lints_and_clippy_utils_have_the_same_version_as_clippy() {
66
let clippy_meta = cargo_metadata::MetadataCommand::new()
77
.no_deps()
88
.exec()
99
.expect("could not obtain cargo metadata");
10-
std::env::set_current_dir(std::env::current_dir().unwrap().join("clippy_lints")).unwrap();
11-
let clippy_lints_meta = cargo_metadata::MetadataCommand::new()
12-
.no_deps()
13-
.exec()
14-
.expect("could not obtain cargo metadata");
15-
assert_eq!(clippy_lints_meta.packages[0].version, clippy_meta.packages[0].version);
16-
for package in &clippy_meta.packages[0].dependencies {
17-
if package.name == "clippy_lints" {
18-
assert!(package.req.matches(&clippy_lints_meta.packages[0].version));
19-
return;
10+
11+
for krate in &["clippy_lints", "clippy_utils"] {
12+
let krate_meta = cargo_metadata::MetadataCommand::new()
13+
.current_dir(std::env::current_dir().unwrap().join(krate))
14+
.no_deps()
15+
.exec()
16+
.expect("could not obtain cargo metadata");
17+
assert_eq!(krate_meta.packages[0].version, clippy_meta.packages[0].version);
18+
for package in &clippy_meta.packages[0].dependencies {
19+
if package.name == *krate {
20+
assert!(package.req.matches(&krate_meta.packages[0].version));
21+
break;
22+
}
2023
}
2124
}
2225
}

0 commit comments

Comments
 (0)