summaryrefslogtreecommitdiffstats
path: root/vendor/xshell/tests/it/tidy.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /vendor/xshell/tests/it/tidy.rs
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/xshell/tests/it/tidy.rs')
-rw-r--r--vendor/xshell/tests/it/tidy.rs37
1 files changed, 37 insertions, 0 deletions
diff --git a/vendor/xshell/tests/it/tidy.rs b/vendor/xshell/tests/it/tidy.rs
new file mode 100644
index 000000000..2b55b2907
--- /dev/null
+++ b/vendor/xshell/tests/it/tidy.rs
@@ -0,0 +1,37 @@
+use xshell::{cmd, Shell};
+
+#[test]
+fn versions_match() {
+ let sh = Shell::new().unwrap();
+
+ let read_version = |path: &str| {
+ let text = sh.read_file(path).unwrap();
+ let vers = text.lines().find(|it| it.starts_with("version =")).unwrap();
+ let vers = vers.splitn(2, '#').next().unwrap();
+ vers.trim_start_matches("version =").trim().trim_matches('"').to_string()
+ };
+
+ let v1 = read_version("./Cargo.toml");
+ let v2 = read_version("./xshell-macros/Cargo.toml");
+ assert_eq!(v1, v2);
+
+ let cargo_toml = sh.read_file("./Cargo.toml").unwrap();
+ let dep = format!("xshell-macros = {{ version = \"={}\",", v1);
+ assert!(cargo_toml.contains(&dep));
+}
+
+#[test]
+fn formatting() {
+ let sh = Shell::new().unwrap();
+
+ cmd!(sh, "cargo fmt --all -- --check").run().unwrap()
+}
+
+#[test]
+fn current_version_in_changelog() {
+ let sh = Shell::new().unwrap();
+ let _p = sh.push_dir(env!("CARGO_MANIFEST_DIR"));
+ let changelog = sh.read_file("CHANGELOG.md").unwrap();
+ let current_version_header = format!("## {}", env!("CARGO_PKG_VERSION"));
+ assert_eq!(changelog.lines().filter(|&line| line == current_version_header).count(), 1);
+}