Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions tox/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,39 @@ pub use tox_core as core;
pub use tox_crypto as crypto;
pub use tox_encryptsave as encryptsave;
pub use tox_packet as packet;

pub fn crate_version() -> String {
env!("CARGO_PKG_VERSION").to_string()
}
pub fn crate_version_major() -> u32 {
env!("CARGO_PKG_VERSION_MAJOR").parse().expect("Invalid major version")
}
pub fn crate_version_minor() -> u32 {
env!("CARGO_PKG_VERSION_MINOR").parse().expect("Invalid minor version")
}
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();
}
}