mirror of
https://seed.radicle.dev/rad:z6cFWeWpnZNHh9rUW8phgA3b5yGt.git
synced 2026-10-31 17:00:46 +08:00
Instead of creating a named feature flag, opt for using the `serde` package name as the feature flag name. This makes it more clear that the feature is only enabling serde serialization and nothing else. This patch also cleans up the testing flags by removing the serialize flag for testing, as this should just always be tested, and also adds the syntax flag for future testing. Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com> X-Clacks-Overhead: GNU Terry Pratchett
33 lines
896 B
Rust
33 lines
896 B
Rust
use std::str::FromStr;
|
|
|
|
use proptest::prelude::*;
|
|
use radicle_git_ext::Oid;
|
|
use radicle_surf::git::{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()],
|
|
})
|
|
}
|