promote src/git/ files to src/

Signed-off-by: Han Xu <keepsimple@gmail.com>
This commit is contained in:
Han Xu
2023-01-05 19:19:14 -08:00
parent 575d44e8b4
commit 60596232da
30 changed files with 133 additions and 133 deletions
+32
View File
@@ -0,0 +1,32 @@
use std::str::FromStr;
use proptest::prelude::*;
use radicle_git_ext::Oid;
use radicle_surf::{Author, Commit};
use test_helpers::roundtrip;
proptest! {
#[test]
fn prop_test_commits(commit in commits_strategy()) {
roundtrip::json(commit)
}
}
fn commits_strategy() -> impl Strategy<Value = Commit> {
("[a-fA-F0-9]{40}", any::<String>(), any::<i64>()).prop_map(|(id, text, time)| Commit {
id: Oid::from_str(&id).unwrap(),
author: Author {
name: text.clone(),
email: text.clone(),
time: git2::Time::new(time, 0),
},
committer: Author {
name: text.clone(),
email: text.clone(),
time: git2::Time::new(time, 0),
},
message: text.clone(),
summary: text,
parents: vec![Oid::from_str(&id).unwrap(), Oid::from_str(&id).unwrap()],
})
}