From 8a57e6f83427b07f0ed4482fe367c264b3091f89 Mon Sep 17 00:00:00 2001 From: Nicolas Bigaouette Date: Sun, 17 Mar 2019 17:32:24 -0400 Subject: [PATCH] Add test making sure Cargo.toml version matches the git tag --- src/main.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/main.rs b/src/main.rs index 3929829..bfffad7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -122,3 +122,20 @@ pub fn python_shim( shim::run(&interpreter_to_use, command, arguments) } + +#[cfg(test)] +mod tests { + + #[test] + fn version() { + let crate_version = structopt::clap::crate_version!(); + + // GIT_VERSION is of the shape `v0.1.7-1-g095d7f5-modified` + + // Strip out the `v` prefix + let (v, git_version_without_v) = crate::GIT_VERSION.split_at(1); + + assert_eq!(v, "v"); + assert!(git_version_without_v.starts_with(crate_version)); + } +}