diff options
| author | Robin Krahl <robin.krahl@ireas.org> | 2019-01-16 20:28:31 +0000 | 
|---|---|---|
| committer | Robin Krahl <robin.krahl@ireas.org> | 2019-01-16 21:29:38 +0100 | 
| commit | 679791064169a37ad9d88b910b7553ebf7133c07 (patch) | |
| tree | 7cba0b9a818fded1ce11afb091784674aac2c645 | |
| parent | d72641832a6c8622cf6468987b5b0aa5bd4c1c39 (diff) | |
| download | nitrokey-rs-679791064169a37ad9d88b910b7553ebf7133c07.tar.gz nitrokey-rs-679791064169a37ad9d88b910b7553ebf7133c07.tar.bz2 | |
Document and test empty Git versions
If libnitrokey has not been built from a clone of the Git repository,
the Git version string may be empty.
| -rw-r--r-- | src/lib.rs | 5 | ||||
| -rw-r--r-- | tests/lib.rs | 3 | 
2 files changed, 4 insertions, 4 deletions
| @@ -111,12 +111,13 @@ pub use crate::util::{CommandError, LogLevel};  /// version.  #[derive(Clone, Debug, PartialEq)]  pub struct Version { -    /// The library version as a string. +    /// The Git library version as a string.      ///      /// The library version is the output of `git describe --always` at compile time, for example      /// `v3.3` or `v3.4.1`.  If the library has not been built from a release, the version string      /// contains the number of commits since the last release and the hash of the current commit, for -    /// example `v3.3-19-gaee920b`. +    /// example `v3.3-19-gaee920b`.  If the library has not been built from a Git checkout, this +    /// string may be empty.      pub git: String,      /// The major library version.      pub major: u32, diff --git a/tests/lib.rs b/tests/lib.rs index 06de0ad..c92e224 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -2,7 +2,6 @@  fn get_library_version() {      let version = nitrokey::get_library_version(); -    assert!(!version.git.is_empty()); -    assert!(version.git.starts_with("v")); +    assert!(version.git.is_empty() || version.git.starts_with("v"));      assert!(version.major > 0);  } | 
