Lines
100 %
Functions
Branches
use super::*;
#[test]
fn full_hash_is_forty_hex_digits() -> io::Result<()> {
let hash = commit_hash(false)?;
assert_eq!(hash.len(), 40);
assert!(hash.chars().all(|c| c.is_ascii_hexdigit()));
Ok(())
}
fn short_hash_prefixes_full_hash() -> io::Result<()> {
assert!(commit_hash(false)?.starts_with(&commit_hash(true)?));
fn commit_date_is_rfc3339() -> io::Result<()> {
let date = commit_date()?;
assert_eq!(date.matches('T').count(), 1, "{date}");
assert!(date.len() >= 20, "{date}");
fn head_files_are_existing_absolute_paths_including_head() -> io::Result<()> {
let files = head_files()?;
assert!(files.iter().any(|f| f.ends_with("HEAD")));
assert!(files.iter().all(|f| f.starts_with('/')));
assert!(files.iter().all(|f| Path::new(f).exists()), "{files:?}");
fn git_reports_failure_for_bad_arguments() {
assert!(git(&["rev-parse", "--verify", "no-such-ref-xyz"]).is_err());