From 4ddd4289f6370a5fcf9418d6973bbc04aa854f69 Mon Sep 17 00:00:00 2001 From: Alessandro Menezes Date: Mon, 10 Oct 2022 07:02:24 -0400 Subject: [PATCH] Improve code coverage of src/info/repo/commits.rs --- src/info/repo/commits.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/info/repo/commits.rs b/src/info/repo/commits.rs index a9b409ab5..f8d6527ce 100644 --- a/src/info/repo/commits.rs +++ b/src/info/repo/commits.rs @@ -45,4 +45,23 @@ mod test { assert_eq!(commits_info.value(), "3".to_string()); } + + #[test] + fn test_display_commits_info_shallow() { + use crate::info::git::Commits; + use git_repository::actor::Time; + + let timestamp = Time::now_utc(); + let commits = Commits { + authors: vec![], + total_num_authors: 0, + num_commits: 2, + is_shallow: true, + time_of_most_recent_commit: timestamp, + time_of_first_commit: timestamp, + }; + + let info = CommitsInfo::new(&commits); + assert_eq!(info.value(), "2 (shallow)".to_string()); + } }