Skip to content

Commit 3cddbfc

Browse files
committed
fix version string formatting
1 parent e5a4e07 commit 3cddbfc

File tree

1 file changed

+20
-1
lines changed
  • clarity-serialization/src

1 file changed

+20
-1
lines changed

clarity-serialization/src/lib.rs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,27 @@ pub fn version_string(pkg_name: &str, pkg_version: &str) -> String {
5151
let git_tree_clean = GIT_TREE_CLEAN.unwrap_or("");
5252

5353
format!(
54-
"{pkg_name} {pkg_version} ({git_branch}:{git_commit}{git_tree_clean}, {BUILD_TYPE} build {}, [{}])",
54+
"{pkg_name} {pkg_version} ({git_branch}:{git_commit}{git_tree_clean}, {BUILD_TYPE} build, {} [{}])",
5555
std::env::consts::OS,
5656
std::env::consts::ARCH
5757
)
5858
}
59+
60+
#[cfg(test)]
61+
mod lib_tests {
62+
use super::*;
63+
64+
#[test]
65+
fn test_version_string_basic_no_env() {
66+
let version = version_string("test-package", "1.0.0");
67+
68+
assert_eq!(
69+
version,
70+
format!(
71+
"test-package 1.0.0 (:, {BUILD_TYPE} build, {} [{}])",
72+
std::env::consts::OS,
73+
std::env::consts::ARCH
74+
)
75+
);
76+
}
77+
}

0 commit comments

Comments
 (0)