Skip to content

Commit

Permalink
Improve code coverage of src/info/repo/commits.rs (#813)
Browse files Browse the repository at this point in the history
  • Loading branch information
alessandroasm authored Oct 10, 2022
1 parent 7f37977 commit c88541d
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/info/repo/commits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}

0 comments on commit c88541d

Please sign in to comment.