mirror of
https://github.com/hinto-janai/cuprate.git
synced 2025-03-27 01:29:06 +00:00
34 lines
783 B
Rust
34 lines
783 B
Rust
//! General constants used throughout `cuprated`.
|
|
|
|
use const_format::formatcp;
|
|
|
|
/// `cuprated`'s semantic version (`MAJOR.MINOR.PATCH`) as string.
|
|
pub const VERSION: &str = clap::crate_version!();
|
|
|
|
/// [`VERSION`] + the build type.
|
|
///
|
|
/// If a debug build, the suffix is `-debug`, else it is `-release`.
|
|
pub const VERSION_BUILD: &str = if cfg!(debug_assertions) {
|
|
formatcp!("{VERSION}-debug")
|
|
} else {
|
|
formatcp!("{VERSION}-release")
|
|
};
|
|
|
|
#[cfg(test)]
|
|
mod test {
|
|
use super::*;
|
|
|
|
#[test]
|
|
fn version() {
|
|
assert_eq!(VERSION, "0.0.1");
|
|
}
|
|
|
|
#[test]
|
|
fn version_build() {
|
|
if cfg!(debug_assertions) {
|
|
assert_eq!(VERSION_BUILD, "0.0.1-debug");
|
|
} else {
|
|
assert_eq!(VERSION_BUILD, "0.0.1-release");
|
|
}
|
|
}
|
|
}
|