From 4d4ecdd603241d1f36ae640697c1e0bae4e81160 Mon Sep 17 00:00:00 2001 From: Nils Fenner Date: Thu, 23 Nov 2023 10:36:04 +0100 Subject: [PATCH] Add crate version tests --- tox/src/lib.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tox/src/lib.rs b/tox/src/lib.rs index b39b0253..c508111e 100644 --- a/tox/src/lib.rs +++ b/tox/src/lib.rs @@ -17,3 +17,26 @@ pub fn crate_version_minor() -> u32 { pub fn crate_version_patch() -> u32 { env!("CARGO_PKG_VERSION_PATCH").parse().expect("Invalid patch version") } + +#[cfg(test)] +mod tests { + #[test] + fn crate_version_is_not_empty() { + assert_ne!(crate::crate_version(), ""); + } + + #[test] + fn crate_version_major() { + crate::crate_version_major(); + } + + #[test] + fn crate_version_minor() { + crate::crate_version_minor(); + } + + #[test] + fn crate_version_patch() { + crate::crate_version_patch(); + } +}