treewide: Remove test_ prefix from test fns

This redundancy does not add much. These functions are already marked
via `#[test]`, and often times they are in a separate module named
"test" or "tests".
This commit is contained in:
Lorenz Leutgeb
2026-09-08 14:47:53 +02:00
parent 7e1cb406bb
commit d8298a1d4c
78 changed files with 383 additions and 381 deletions
+3 -3
View File
@@ -576,7 +576,7 @@ mod tests {
use pretty_assertions::assert_eq;
#[test]
fn test_parse() {
fn parse() {
let input = r#"
Let's try to track @dave and @sean:
``` RAD_HINT=true
@@ -664,7 +664,7 @@ $ rad sync
}
#[test]
fn test_run() {
fn run() {
let input = r#"
Running a simple command such as `head`:
```
@@ -688,7 +688,7 @@ name = "radicle-cli-test"
}
#[test]
fn test_example_spaced_brackets() {
fn example_spaced_brackets() {
let input = r#"
Running a simple command such as `head`:
```
+3 -4
View File
@@ -309,10 +309,9 @@ fn tree(mut refs: Vec<String>) -> String {
#[cfg(test)]
mod test {
use super::*;
#[test]
fn test_tree() {
fn tree() {
let arg = vec![
String::from("z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/refs/heads/master"),
String::from("z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/refs/rad/id"),
@@ -329,7 +328,7 @@ z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
"#
.trim_start();
assert_eq!(tree(arg), exp);
assert_eq!(tree(vec![String::new()]), "\n");
assert_eq!(super::tree(arg), exp);
assert_eq!(super::tree(vec![String::new()]), "\n");
}
}
@@ -964,7 +964,7 @@ mod tests {
use super::*;
#[test]
fn test_review_comments_basic() {
fn review_comments_basic() {
let input = r#"
> @@ -2559,18 +2560,18 @@ where
> // Only consider onion addresses if configured.
@@ -1081,7 +1081,7 @@ Comment #5.
}
#[test]
fn test_review_comments_multiline() {
fn review_comments_multiline() {
let input = r#"
> @@ -2559,9 +2560,7 @@ where
> // Only consider onion addresses if configured.
@@ -1176,7 +1176,7 @@ Woof.
}
#[test]
fn test_review_comments_before() {
fn review_comments_before() {
let input = r#"
This is a top-level comment.
@@ -1228,7 +1228,7 @@ This is a top-level comment.
}
#[test]
fn test_review_comments_split_hunk() {
fn review_comments_split_hunk() {
let input = r#"
> @@ -2559,6 +2560,4 @@ where
> // Only consider onion addresses if configured.
+2 -2
View File
@@ -469,7 +469,7 @@ mod test {
use std::str::FromStr;
#[test]
fn test_version_ord() {
fn version_ord() {
assert!(
Version {
major: 2,
@@ -495,7 +495,7 @@ mod test {
}
#[test]
fn test_version_from_str() {
fn version_from_str() {
assert_eq!(
Version::from_str("git version 2.34.1\n").ok(),
Some(Version {
+1 -1
View File
@@ -600,7 +600,7 @@ mod test {
#[test]
#[ignore]
fn test_pretty() {
fn pretty() {
let repo = Repository::open_ext::<_, _, &[&OsStr]>(
env!("CARGO_MANIFEST_DIR"),
RepositoryOpenFlags::all(),
+2 -2
View File
@@ -620,7 +620,7 @@ mod test {
use super::*;
#[test]
fn test_diff_encode_decode_diff() {
fn diff_encode_decode_diff() {
let diff_a = diff::Diff::parse(include_str!(concat!(
env!("CARGO_MANIFEST_DIR"),
"/tests/data/diff.diff"
@@ -636,7 +636,7 @@ mod test {
}
#[test]
fn test_diff_content_encode_decode_content() {
fn diff_content_encode_decode_content() {
let diff_content = diff::DiffContent::parse(include_str!(concat!(
env!("CARGO_MANIFEST_DIR"),
"/tests/data/diff_body.diff"
+15 -13
View File
@@ -413,10 +413,9 @@ pub mod identity {
#[cfg(test)]
mod test {
use super::*;
use html::strip_comments;
#[test]
fn test_strip_comments() {
fn strip_comments() {
let test = "\
commit 2\n\
\n\
@@ -428,7 +427,7 @@ mod test {
commit 2\n\
";
let res = strip_comments(test);
let res = html::strip_comments(test);
assert_eq!(exp, res);
let test = "\
@@ -438,7 +437,7 @@ mod test {
commit 2\n\
-->";
let res = strip_comments(test);
let res = html::strip_comments(test);
assert_eq!(exp, res);
let test = "\
@@ -447,7 +446,7 @@ mod test {
";
let exp = "";
let res = strip_comments(test);
let res = html::strip_comments(test);
assert_eq!(exp, res);
let test = "\
@@ -464,17 +463,20 @@ mod test {
\n\
-->";
let res = strip_comments(test);
let res = html::strip_comments(test);
assert_eq!(exp, res);
}
#[test]
fn test_bytes() {
assert_eq!(bytes(1023).to_string(), "1023 B");
assert_eq!(bytes(1024).to_string(), "1 KiB");
assert_eq!(bytes(1024 * 9).to_string(), "9 KiB");
assert_eq!(bytes(1024usize.pow(2)).to_string(), "1 MiB");
assert_eq!(bytes(1024usize.pow(2) * 56).to_string(), "56 MiB");
assert_eq!(bytes(1024usize.pow(3) * 1024).to_string(), "1024 GiB");
fn bytes() {
assert_eq!(super::bytes(1023).to_string(), "1023 B");
assert_eq!(super::bytes(1024).to_string(), "1 KiB");
assert_eq!(super::bytes(1024 * 9).to_string(), "9 KiB");
assert_eq!(super::bytes(1024usize.pow(2)).to_string(), "1 MiB");
assert_eq!(super::bytes(1024usize.pow(2) * 56).to_string(), "56 MiB");
assert_eq!(
super::bytes(1024usize.pow(3) * 1024).to_string(),
"1024 GiB"
);
}
}
+10 -10
View File
@@ -523,7 +523,7 @@ mod test {
}
#[test]
fn test_create_display_message() {
fn create_display_message() {
let tmpdir = tempfile::tempdir().unwrap();
let (repo, commit_0) = fixtures::repository(&tmpdir);
let commit_1 = commit(
@@ -539,7 +539,7 @@ mod test {
"Commit 2\n\nDescription\n",
);
let res = create_display_message(&repo, &commit_0, &commit_0).unwrap();
let res = super::create_display_message(&repo, &commit_0, &commit_0).unwrap();
assert_eq!(
"\
<!--\n\
@@ -555,7 +555,7 @@ mod test {
res
);
let res = create_display_message(&repo, &commit_0, &commit_1).unwrap();
let res = super::create_display_message(&repo, &commit_0, &commit_1).unwrap();
assert_eq!(
"\
Commit 1\n\
@@ -575,7 +575,7 @@ mod test {
res
);
let res = create_display_message(&repo, &commit_0, &commit_2).unwrap();
let res = super::create_display_message(&repo, &commit_0, &commit_2).unwrap();
assert_eq!(
"\
<!--\n\
@@ -610,8 +610,8 @@ mod test {
}
#[test]
fn test_edit_display_message() {
let res = edit_display_message("title", "The patch description.");
fn edit_display_message() {
let res = super::edit_display_message("title", "The patch description.");
assert_eq!(
"\
title\n\
@@ -633,7 +633,7 @@ mod test {
}
#[test]
fn test_update_display_message() {
fn update_display_message() {
let tmpdir = tempfile::tempdir().unwrap();
let (repo, commit_0) = fixtures::repository(&tmpdir);
@@ -646,7 +646,7 @@ mod test {
"commit squashed",
);
let res = update_display_message(&repo, &commit_1, &commit_1).unwrap();
let res = super::update_display_message(&repo, &commit_1, &commit_1).unwrap();
assert_eq!(
"\
<!--\n\
@@ -657,7 +657,7 @@ mod test {
res
);
let res = update_display_message(&repo, &commit_1, &commit_2).unwrap();
let res = super::update_display_message(&repo, &commit_1, &commit_2).unwrap();
assert_eq!(
"\
commit 2\n\
@@ -670,7 +670,7 @@ mod test {
res
);
let res = update_display_message(&repo, &commit_1, &commit_squashed).unwrap();
let res = super::update_display_message(&repo, &commit_1, &commit_squashed).unwrap();
assert_eq!(
"\
<!--\n\
+1 -1
View File
@@ -276,7 +276,7 @@ fn rad_clone_unknown() {
#[test]
// User tries to clone; no seeds are available, but user has the repo locally.
fn test_clone_without_seeds() {
fn clone_without_seeds() {
let mut environment = Environment::new();
let mut alice = environment.node("alice");
let working = environment.tempdir().join("working");
+2 -2
View File
@@ -102,7 +102,7 @@ fn rad_cob_operations() {
}
#[test]
fn test_cob_replication() {
fn cob_replication() {
let mut environment = Environment::new();
let working = tempfile::tempdir().unwrap();
let mut alice = environment.node("alice");
@@ -171,7 +171,7 @@ fn test_cob_replication() {
}
#[test]
fn test_cob_deletion() {
fn cob_deletion() {
let mut environment = Environment::new();
let working = tempfile::tempdir().unwrap();
let mut alice = environment.node("alice");
+1 -1
View File
@@ -109,7 +109,7 @@ fn rad_sync() {
//
// alice -- seed -- bob
//
fn test_replication_via_seed() {
fn replication_via_seed() {
let mut environment = Environment::new();
let alice = environment.relay("alice");
let bob = environment.relay("bob");
+1 -1
View File
@@ -98,7 +98,7 @@ mod tests {
use super::*;
#[test]
fn test_serde() {
fn serde() {
let id = ObjectId::from_str("3ad84420bd882f983c2f9b605e7a68f5bdf95f5c").unwrap();
assert_eq!(
+4 -4
View File
@@ -82,23 +82,23 @@ pub mod fmt {
use alloc::str::FromStr;
#[test]
fn test_key() {
fn key() {
let pk =
PublicKey::from_str("z6MktWkM9vcfysWFq1c2aaLjJ6j4PYYg93TLPswR4qtuoAeT").unwrap();
assert_eq!(
key(&pk),
super::key(&pk),
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINDoXIrhcnRjnLGUXUFdxhkuy08lkTOwrj2IoGsEX6+Q"
);
}
#[test]
fn test_fingerprint() {
fn fingerprint() {
let pk =
PublicKey::from_str("z6MktWkM9vcfysWFq1c2aaLjJ6j4PYYg93TLPswR4qtuoAeT").unwrap();
assert_eq!(
fingerprint(&pk),
super::fingerprint(&pk),
"SHA256:gE/Ty4fuXzww49lcnNe9/GI0L7xSEQdFp/v9tOjFwB4"
);
}
+2 -2
View File
@@ -221,7 +221,7 @@ mod test {
use crate::VerifyingKey;
#[test]
fn test_agent_encoding_remove() {
fn agent_encoding_remove() {
use std::str::FromStr;
let pk =
@@ -256,7 +256,7 @@ mod test {
}
#[test]
fn test_agent_encoding_sign() {
fn agent_encoding_sign() {
use std::str::FromStr;
let pk =
+3 -3
View File
@@ -240,7 +240,7 @@ mod tests {
use std::borrow::ToOwned as _;
#[test]
fn test_init_passphrase() {
fn init_passphrase() {
let tmp = tempfile::tempdir().unwrap();
let store = Keystore::new(&tmp);
@@ -265,7 +265,7 @@ mod tests {
}
#[test]
fn test_init_no_passphrase() {
fn init_no_passphrase() {
let tmp = tempfile::tempdir().unwrap();
let store = Keystore::new(&tmp);
@@ -279,7 +279,7 @@ mod tests {
}
#[test]
fn test_signer() {
fn signer() {
let tmp = tempfile::tempdir().unwrap();
let store = Keystore::new(&tmp);
+20 -20
View File
@@ -447,7 +447,7 @@ mod tests {
use super::*;
#[test]
fn test_len() {
fn len() {
let mut dag = Dag::new();
dag.node(0, ());
@@ -458,7 +458,7 @@ mod tests {
}
#[test]
fn test_is_empty() {
fn is_empty() {
let mut dag = Dag::new();
assert!(dag.is_empty());
@@ -467,7 +467,7 @@ mod tests {
}
#[test]
fn test_dependencies() {
fn dependencies() {
let mut dag = Dag::new();
dag.node(0, ());
@@ -479,7 +479,7 @@ mod tests {
}
#[test]
fn test_get() {
fn get() {
let mut dag = Dag::new();
dag.node(0, "rad");
@@ -491,7 +491,7 @@ mod tests {
}
#[test]
fn test_cycle() {
fn cycle() {
let mut dag = Dag::new();
dag.node(0, ());
@@ -507,7 +507,7 @@ mod tests {
}
#[test]
fn test_merge_1() {
fn merge_1() {
let mut a = Dag::new();
let mut b = Dag::new();
let mut c = Dag::new();
@@ -531,7 +531,7 @@ mod tests {
}
#[test]
fn test_merge_2() {
fn merge_2() {
let mut a = Dag::new();
let mut b = Dag::new();
@@ -571,7 +571,7 @@ mod tests {
}
#[test]
fn test_diamond() {
fn diamond() {
let mut dag = Dag::new();
dag.node(0, ());
@@ -595,7 +595,7 @@ mod tests {
}
#[test]
fn test_complex() {
fn complex() {
let mut dag = Dag::new();
dag.node(0, ());
@@ -654,7 +654,7 @@ mod tests {
}
#[test]
fn test_fold_sorting_1() {
fn fold_sorting_1() {
let mut dag = Dag::new();
dag.node("R", ());
@@ -687,7 +687,7 @@ mod tests {
}
#[test]
fn test_fold_sorting_2() {
fn fold_sorting_2() {
let mut dag = Dag::new();
dag.node("R", ());
@@ -722,7 +722,7 @@ mod tests {
}
#[test]
fn test_fold_diamond() {
fn fold_diamond() {
let mut dag = Dag::new();
dag.node("R", ());
@@ -746,7 +746,7 @@ mod tests {
}
#[test]
fn test_fold_multiple_roots() {
fn fold_multiple_roots() {
let mut dag = Dag::new();
dag.node("R", ());
@@ -764,7 +764,7 @@ mod tests {
}
#[test]
fn test_fold_reject() {
fn fold_reject() {
let mut dag = Dag::new();
dag.node("R", ());
@@ -806,7 +806,7 @@ mod tests {
}
#[test]
fn test_remove() {
fn remove() {
let mut dag = Dag::new();
dag.node("R", ());
@@ -849,7 +849,7 @@ mod tests {
}
#[test]
fn test_prune_1() {
fn prune_1() {
let mut dag = Dag::new();
dag.node("R", ());
@@ -880,7 +880,7 @@ mod tests {
}
#[test]
fn test_siblings() {
fn siblings() {
let mut dag = Dag::new();
dag.node("R", ());
@@ -927,7 +927,7 @@ mod tests {
}
#[test]
fn test_prune_2() {
fn prune_2() {
let mut dag = Dag::new();
dag.node("R", ());
@@ -962,7 +962,7 @@ mod tests {
}
#[test]
fn test_prune_by_sorting() {
fn prune_by_sorting() {
let mut dag = Dag::new();
dag.node("R", 0);
@@ -1022,7 +1022,7 @@ mod tests {
}
#[test]
fn test_contains() {
fn contains() {
let mut dag = Dag::<u8, ()>::new();
assert!(!dag.contains(&0));
+1 -1
View File
@@ -312,7 +312,7 @@ mod serde_impls {
use crate::LocalTime;
#[test]
fn test_localtime() {
fn localtime() {
#[derive(serde::Serialize, serde::Deserialize, Debug, PartialEq, Eq)]
struct Test {
time: LocalTime,
+2 -2
View File
@@ -291,7 +291,7 @@ mod tests {
use crate::test;
#[test]
fn test_control_socket() {
fn control_socket() {
let tmp = tempfile::tempdir().unwrap();
let handle = test::handle::Handle::default();
let socket = tmp.path().join("alice.sock");
@@ -341,7 +341,7 @@ mod tests {
}
#[test]
fn test_seed_unseed() {
fn seed_unseed() {
let tmp = tempfile::tempdir().unwrap();
let socket = tmp.path().join("node.sock");
let proj = arbitrary::r#gen::<RepoId>(1);
+3 -3
View File
@@ -67,7 +67,7 @@ mod tests {
use super::*;
#[test]
fn test_wake_exact() {
fn wake_exact() {
let mut tm = Timer::new();
let now = Instant::now();
@@ -80,7 +80,7 @@ mod tests {
}
#[test]
fn test_wake() {
fn wake() {
let mut tm = Timer::new();
let now = Instant::now();
@@ -103,7 +103,7 @@ mod tests {
}
#[test]
fn test_next() {
fn next() {
let mut tm = Timer::new();
let mut now = Instant::now();
+31 -31
View File
@@ -54,7 +54,7 @@ mod config {
//
// alice -- bob
//
fn test_inventory_sync_basic() {
fn inventory_sync_basic() {
let tmp = tempfile::tempdir().unwrap();
let mut alice = Node::init(tmp.path(), config::relay("alice"), 13);
@@ -76,7 +76,7 @@ fn test_inventory_sync_basic() {
//
// alice -- bob -- eve
//
fn test_inventory_sync_bridge() {
fn inventory_sync_bridge() {
let tmp = tempfile::tempdir().unwrap();
let mut alice = Node::init(tmp.path(), config::relay("alice"), 13);
@@ -104,7 +104,7 @@ fn test_inventory_sync_bridge() {
// | |
// carol -- eve
//
fn test_inventory_sync_ring() {
fn inventory_sync_ring() {
let tmp = tempfile::tempdir().unwrap();
let mut alice = Node::init(tmp.path(), config::relay("alice"), 13);
@@ -139,7 +139,7 @@ fn test_inventory_sync_ring() {
// |
// carol
//
fn test_inventory_sync_star() {
fn inventory_sync_star() {
let tmp = tempfile::tempdir().unwrap();
let mut alice = Node::init(tmp.path(), config::relay("alice"), 13);
@@ -279,7 +279,7 @@ fn public_to_private_to_public_replay() {
}
#[test]
fn test_replication() {
fn replication() {
let tmp = tempfile::tempdir().unwrap();
let alice = Node::init(tmp.path(), config::relay("alice"), 13);
let mut bob = Node::init(tmp.path(), config::relay("bob"), 37);
@@ -355,7 +355,7 @@ fn test_replication() {
}
#[test]
fn test_replication_ref_in_sigrefs() {
fn replication_ref_in_sigrefs() {
let tmp = tempfile::tempdir().unwrap();
let alice = Node::init(tmp.path(), config::relay("alice"), 13);
let mut bob = Node::init(tmp.path(), config::relay("bob"), 37);
@@ -406,7 +406,7 @@ fn test_replication_ref_in_sigrefs() {
}
#[test]
fn test_replication_invalid() {
fn replication_invalid() {
let tmp = tempfile::tempdir().unwrap();
let alice = Node::init(tmp.path(), config::relay("alice"), 13);
let mut bob = Node::init(tmp.path(), config::relay("bob"), 37);
@@ -461,7 +461,7 @@ fn test_replication_invalid() {
}
#[test]
fn test_migrated_clone() {
fn migrated_clone() {
let tmp = tempfile::tempdir().unwrap();
let mut alice = Node::init(tmp.path(), config::relay("alice"), 13);
let bob = Node::init(tmp.path(), config::relay("bob"), 37);
@@ -518,7 +518,7 @@ fn test_migrated_clone() {
}
#[test]
fn test_dont_fetch_owned_refs() {
fn dont_fetch_owned_refs() {
let tmp = tempfile::tempdir().unwrap();
let mut alice = Node::init(tmp.path(), config::relay("alice"), 13);
let bob = Node::init(tmp.path(), config::relay("bob"), 37);
@@ -549,7 +549,7 @@ fn test_dont_fetch_owned_refs() {
}
#[test]
fn test_fetch_followed_remotes() {
fn fetch_followed_remotes() {
let tmp = tempfile::tempdir().unwrap();
let mut alice = Node::init(tmp.path(), config::relay("alice"), 13);
let bob = Node::init(tmp.path(), config::relay("bob"), 37);
@@ -605,7 +605,7 @@ fn test_fetch_followed_remotes() {
}
#[test]
fn test_missing_remote() {
fn missing_remote() {
let tmp = tempfile::tempdir().unwrap();
let mut alice = Node::init(tmp.path(), config::relay("alice"), 13);
let bob = Node::init(tmp.path(), config::relay("bob"), 37);
@@ -643,7 +643,7 @@ fn test_missing_remote() {
}
#[test]
fn test_fetch_preserve_owned_refs() {
fn fetch_preserve_owned_refs() {
let tmp = tempfile::tempdir().unwrap();
let mut alice = Node::init(tmp.path(), config::relay("alice"), 13);
let bob = Node::init(tmp.path(), config::relay("bob"), 37);
@@ -693,7 +693,7 @@ fn test_fetch_preserve_owned_refs() {
}
#[test]
fn test_clone() {
fn clone() {
let tmp = tempfile::tempdir().unwrap();
let alice = Node::init(tmp.path(), config::relay("alice"), 13);
let mut bob = Node::init(tmp.path(), config::relay("bob"), 37);
@@ -838,7 +838,7 @@ fn clone_without_founder_namespace() {
}
#[test]
fn test_fetch_up_to_date() {
fn fetch_up_to_date() {
let tmp = tempfile::tempdir().unwrap();
let alice = Node::init(tmp.path(), config::relay("alice"), 13);
let mut bob = Node::init(tmp.path(), config::relay("bob"), 37);
@@ -871,7 +871,7 @@ fn test_fetch_up_to_date() {
}
#[test]
fn test_fetch_unseeded() {
fn fetch_unseeded() {
let tmp = tempfile::tempdir().unwrap();
let alice = Node::init(tmp.path(), config::relay("alice"), 13);
let mut bob = Node::init(tmp.path(), config::relay("bob"), 37);
@@ -904,7 +904,7 @@ fn test_fetch_unseeded() {
}
#[test]
fn test_large_fetch() {
fn large_fetch() {
let tmp = tempfile::tempdir().unwrap();
let scale = config::scale();
let mut alice = Node::init(tmp.path(), config::relay("alice"), 13);
@@ -938,7 +938,7 @@ fn test_large_fetch() {
}
#[test]
fn test_concurrent_fetches() {
fn concurrent_fetches() {
let tmp = tempfile::tempdir().unwrap();
let scale = config::scale();
let repos = scale.max(4);
@@ -1059,7 +1059,7 @@ fn test_concurrent_fetches() {
}
#[test]
fn test_connection_crossing() {
fn connection_crossing() {
let tmp = tempfile::tempdir().unwrap();
let alice = Node::init(tmp.path(), config::relay("alice"), 13);
let bob = Node::init(tmp.path(), config::relay("bob"), 37);
@@ -1140,7 +1140,7 @@ fn test_connection_crossing() {
#[test]
/// Alice is going to try to fetch outdated refs of Bob, from Eve. This is a non-fast-forward fetch
/// on the sigrefs branch.
fn test_non_fast_forward_sigrefs() {
fn non_fast_forward_sigrefs() {
let tmp = tempfile::tempdir().unwrap();
let alice = Node::init(tmp.path(), config::relay("alice"), 13);
@@ -1254,7 +1254,7 @@ fn test_non_fast_forward_sigrefs() {
}
#[test]
fn test_outdated_sigrefs() {
fn outdated_sigrefs() {
let tmp = tempfile::tempdir().unwrap();
let mut alice = Node::init(tmp.path(), config::relay("alice"), 13);
@@ -1363,7 +1363,7 @@ fn test_outdated_sigrefs() {
}
#[test]
fn test_outdated_delegate_sigrefs() {
fn outdated_delegate_sigrefs() {
let tmp = tempfile::tempdir().unwrap();
let mut alice = Node::init(tmp.path(), config::relay("alice"), 13);
@@ -1661,7 +1661,7 @@ fn missing_delegate_default_branch() {
}
#[test]
fn test_background_foreground_fetch() {
fn background_foreground_fetch() {
let tmp = tempfile::tempdir().unwrap();
let mut alice = Node::init(tmp.path(), config::relay("alice"), 13);
@@ -1758,7 +1758,7 @@ fn test_background_foreground_fetch() {
#[test]
/// Alice is offline while Bob pushes some changes to the repo. When Alice reconnects,
/// she is made aware of the changes via the `subscribe` message, and fetches from the seed.
fn test_catchup_on_refs_announcements() {
fn catchup_on_refs_announcements() {
let tmp = tempfile::tempdir().unwrap();
let mut alice = Node::init(tmp.path(), config::relay("alice"), 13);
let bob = Node::init(tmp.path(), config::relay("bob"), 37);
@@ -1794,7 +1794,7 @@ fn test_catchup_on_refs_announcements() {
}
#[test]
fn test_multiple_offline_inits() {
fn multiple_offline_inits() {
let tmp = tempfile::tempdir().unwrap();
let mut alice = Node::init(tmp.path(), config::relay("alice"), 13);
@@ -1820,7 +1820,7 @@ fn test_multiple_offline_inits() {
}
#[test]
fn test_channel_reader_limit() {
fn channel_reader_limit() {
let tmp = tempfile::tempdir().unwrap();
let mut alice = Node::init(tmp.path(), config::relay("alice"), 13);
let limits = radicle::node::config::Limits {
@@ -1865,7 +1865,7 @@ fn test_channel_reader_limit() {
}
#[test]
fn test_fetch_emits_canonical_ref_update() {
fn fetch_emits_canonical_ref_update() {
let tmp = tempfile::tempdir().unwrap();
let scale = config::scale();
let mut alice = Node::init(tmp.path(), config::relay("alice"), 13);
@@ -1915,7 +1915,7 @@ fn test_fetch_emits_canonical_ref_update() {
}
#[test]
fn test_non_fast_forward_identity_doc() {
fn non_fast_forward_identity_doc() {
use radicle::identity::Identity;
let tmp = tempfile::tempdir().unwrap();
@@ -2033,7 +2033,7 @@ fn test_non_fast_forward_identity_doc() {
}
#[test]
fn test_block_active_connection() {
fn block_active_connection() {
let tmp = tempfile::tempdir().unwrap();
let alice = Node::init(tmp.path(), config::relay("alice"), 13);
let bob = Node::init(tmp.path(), config::relay("bob"), 37);
@@ -2059,7 +2059,7 @@ fn test_block_active_connection() {
}
#[test]
fn test_block_prevents_connection() {
fn block_prevents_connection() {
let tmp = tempfile::tempdir().unwrap();
let alice = Node::init(tmp.path(), config::relay("alice"), 13);
let bob = Node::init(tmp.path(), config::relay("bob"), 37);
@@ -2092,7 +2092,7 @@ fn test_block_prevents_connection() {
}
#[test]
fn test_block_prevents_fetch() {
fn block_prevents_fetch() {
let tmp = tempfile::tempdir().unwrap();
let alice = Node::init(tmp.path(), config::relay("alice"), 13);
let mut bob = Node::init(tmp.path(), config::relay("bob"), 37);
@@ -2165,7 +2165,7 @@ fn fetch_does_not_contain_rad_sigrefs_parent() {
}
#[test]
fn test_fetch_emits_canonical_ref_update_partial_glob() {
fn fetch_emits_canonical_ref_update_partial_glob() {
let tmp = tempfile::tempdir().unwrap();
let scale = config::scale();
let mut alice = Node::init(tmp.path(), config::relay("alice"), 13);
+2 -2
View File
@@ -1305,7 +1305,7 @@ mod test {
use crate::wire::varint;
#[test]
fn test_pong_message_with_extension() {
fn pong_message_with_extension() {
use protocol::deserializer;
let mut stream = Vec::new();
@@ -1336,7 +1336,7 @@ mod test {
}
#[test]
fn test_inventory_ann_with_extension() {
fn inventory_ann_with_extension() {
use protocol::deserializer;
#[derive(Debug)]
+2 -2
View File
@@ -126,7 +126,7 @@ mod test {
const MSG_BYE: &[u8] = &[3, b'b', b'y', b'e'];
#[test]
fn test_decode_next() {
fn decode_next() {
let mut decoder = Deserializer::<1024, String>::new(8);
decoder.input(&[3, b'b']).unwrap();
@@ -144,7 +144,7 @@ mod test {
}
#[test]
fn test_unparsed() {
fn unparsed() {
let mut decoder = Deserializer::<1024, String>::new(8);
decoder.input(&[3, b'b', b'y']).unwrap();
@@ -172,7 +172,7 @@ mod tests {
use crate::fetcher::{FetchConfig, MaxQueueSize};
#[test]
fn test_fetch_coalescing_different_refs() {
fn fetch_coalescing_different_refs() {
let config = Config::new()
.with_max_concurrency(NonZeroUsize::new(1).unwrap())
.with_max_capacity(MaxQueueSize::new(NonZeroUsize::new(10).unwrap()));
@@ -136,7 +136,7 @@ mod test {
use radicle::test::arbitrary;
#[test]
fn test_parameters() {
fn parameters() {
// To store 10'000 items with a false positive rate of 1%, we need about 12KB.
assert_eq!(bloomy::bloom::optimal_bits(10_000, 0.01) / 8, 11_981);
// To store 1'000 items with a false positive rate of 1%, we need about 1KB.
@@ -175,7 +175,7 @@ mod test {
}
#[test]
fn test_sizes() {
fn sizes() {
let ids = arbitrary::vec::<RepoId>(3420);
let f = Filter::new(ids.iter().cloned().take(10));
assert_eq!(f.size(), FILTER_SIZE_S);
@@ -405,7 +405,7 @@ mod test {
use radicle::test::arbitrary;
#[test]
fn test_announced() {
fn announced() {
let mut db = Database::memory().unwrap();
let nid = arbitrary::r#gen::<NodeId>(1);
let rid = arbitrary::r#gen::<RepoId>(1);
@@ -155,7 +155,7 @@ mod test {
}
#[test]
fn test_limiter_refill() {
fn limiter_refill() {
let mut r = RateLimiter::default();
let t = (3, 0.2); // Three tokens burst. One token every 5 seconds.
let a = HostName::Dns(String::from("seed.radicle.example.com"));
@@ -187,7 +187,7 @@ mod test {
#[test]
#[rustfmt::skip]
fn test_limiter_multi() {
fn limiter_multi() {
let t = (1, 1.0); // One token per second. One token burst.
let n = arbitrary::r#gen::<NodeId>(1);
let n = Some(&n);
@@ -207,7 +207,7 @@ mod test {
#[test]
#[rustfmt::skip]
fn test_limiter_different_rates() {
fn limiter_different_rates() {
let t1 = (1, 1.0); // One token per second. One token burst.
let t2 = (2, 2.0); // Two tokens per second. Two token burst.
let n = arbitrary::r#gen::<NodeId>(1);
@@ -692,7 +692,7 @@ mod tests {
use super::*;
#[test]
fn test_ref_remote_limit() {
fn ref_remote_limit() {
let mut refs = BoundedVec::<_, REF_REMOTE_LIMIT>::new();
let signer = SigningKey::mock(18);
let at = git::Oid::ZERO_SHA1;
@@ -724,7 +724,7 @@ mod tests {
}
#[test]
fn test_inventory_limit() {
fn inventory_limit() {
let msg = Message::inventory(
InventoryAnnouncement {
inventory: arbitrary::vec(INVENTORY_LIMIT)
@@ -772,7 +772,7 @@ mod tests {
}
#[test]
fn test_node_announcement_validate() {
fn node_announcement_validate() {
let ann = NodeAnnouncement {
version: 1,
features: node::Features::SEED,
+4 -4
View File
@@ -628,7 +628,7 @@ mod tests {
}
#[test]
fn test_string() {
fn string() {
assert_eq!(
String::from("hello").encode_to_vec(),
vec![5, b'h', b'e', b'l', b'l', b'o']
@@ -636,7 +636,7 @@ mod tests {
}
#[test]
fn test_alias() {
fn alias() {
assert_eq!(
Alias::from_str("hello").unwrap().encode_to_vec(),
vec![5, b'h', b'e', b'l', b'l', b'o']
@@ -644,7 +644,7 @@ mod tests {
}
#[test]
fn test_filter_invalid() {
fn filter_invalid() {
let b = bloomy::BloomFilter::with_size(filter::FILTER_SIZE_M / 3);
let f = filter::Filter::from(b);
let bytes = f.encode_to_vec();
@@ -656,7 +656,7 @@ mod tests {
}
#[test]
fn test_bounded_vec_limit() {
fn bounded_vec_limit() {
let v: BoundedVec<u8, 2> = vec![1, 2].try_into().unwrap();
let buf = &v.encode_to_vec();
+2 -2
View File
@@ -400,7 +400,7 @@ mod test {
use super::*;
#[test]
fn test_stream_id() {
fn stream_id() {
assert_eq!(StreamId(VarInt(0b000)).kind().unwrap(), StreamType::Control);
assert_eq!(StreamId(VarInt(0b010)).kind().unwrap(), StreamType::Gossip);
assert_eq!(StreamId(VarInt(0b100)).kind().unwrap(), StreamType::Git);
@@ -419,7 +419,7 @@ mod test {
}
#[test]
fn test_encode_git_large() {
fn encode_git_large() {
use wire::Encode as _;
let size = u16::MAX as usize * 3;
+6 -6
View File
@@ -422,7 +422,7 @@ mod tests {
prop_roundtrip!(Message);
#[test]
fn test_refs_ann_max_size() {
fn refs_ann_max_size() {
let signer = radicle::crypto::SigningKey::mock(235);
let refs: [RefsAt; REF_REMOTE_LIMIT] = arbitrary::r#gen(1);
let ann = AnnouncementMessage::Refs(RefsAnnouncement {
@@ -438,7 +438,7 @@ mod tests {
}
#[test]
fn test_inv_ann_max_size() {
fn inv_ann_max_size() {
let signer = radicle::crypto::SigningKey::mock(147);
let inv: [RepoId; INVENTORY_LIMIT] = arbitrary::r#gen(1);
let ann = AnnouncementMessage::Inventory(InventoryAnnouncement {
@@ -453,7 +453,7 @@ mod tests {
}
#[test]
fn test_node_ann_max_size() {
fn node_ann_max_size() {
let signer = radicle::crypto::SigningKey::mock(247);
let addrs: [Address; ADDRESS_LIMIT] = arbitrary::r#gen(1);
let alias = ['@'; radicle::node::MAX_ALIAS_LENGTH];
@@ -474,7 +474,7 @@ mod tests {
}
#[test]
fn test_pingpong_encode_max_size() {
fn pingpong_encode_max_size() {
Message::Ping(Ping {
ponglen: 0,
zeroes: ZeroBytes::new(Ping::MAX_PING_ZEROES),
@@ -489,7 +489,7 @@ mod tests {
#[test]
#[should_panic(expected = "advance out of bounds")]
fn test_ping_encode_size_overflow() {
fn ping_encode_size_overflow() {
Message::Ping(Ping {
ponglen: 0,
zeroes: ZeroBytes::new(Ping::MAX_PING_ZEROES + 1),
@@ -499,7 +499,7 @@ mod tests {
#[test]
#[should_panic(expected = "advance out of bounds")]
fn test_pong_encode_size_overflow() {
fn pong_encode_size_overflow() {
Message::Pong {
zeroes: ZeroBytes::new(Ping::MAX_PONG_ZEROES + 1),
}
+2 -2
View File
@@ -218,12 +218,12 @@ mod test {
#[test]
#[should_panic(expected = "overflow")]
fn test_encode_overflow() {
fn encode_overflow() {
VarInt(u64::MAX).encode_to_vec();
}
#[test]
fn test_encoding() {
fn encoding() {
assert_eq!(VarInt(0).encode_to_vec(), vec![0x0]);
assert_eq!(VarInt(1).encode_to_vec(), vec![0x01]);
assert_eq!(VarInt(10).encode_to_vec(), vec![0x0a]);
+12 -12
View File
@@ -125,7 +125,7 @@ mod tests {
use super::*;
#[test]
fn test_capabilities() {
fn capabilities() {
assert_eq!(
Command::parse_line("capabilities").unwrap(),
Line::Valid(Command::Capabilities)
@@ -133,7 +133,7 @@ mod tests {
}
#[test]
fn test_list() {
fn list() {
assert_eq!(
Command::parse_line("list").unwrap(),
Line::Valid(Command::List)
@@ -141,7 +141,7 @@ mod tests {
}
#[test]
fn test_list_for_push() {
fn list_for_push() {
assert_eq!(
Command::parse_line("list for-push").unwrap(),
Line::Valid(Command::ListForPush)
@@ -149,7 +149,7 @@ mod tests {
}
#[test]
fn test_fetch() {
fn fetch() {
assert_eq!(
Command::parse_line("fetch oid ref").unwrap(),
Line::Valid(Command::Fetch {
@@ -160,7 +160,7 @@ mod tests {
}
#[test]
fn test_fetch_whitespace() {
fn fetch_whitespace() {
assert_eq!(
Command::parse_line("fetch oid ref").unwrap(),
Line::Valid(Command::Fetch {
@@ -171,7 +171,7 @@ mod tests {
}
#[test]
fn test_push() {
fn push() {
assert_eq!(
Command::parse_line("push src:dst").unwrap(),
Line::Valid(Command::Push("src:dst".to_owned()))
@@ -179,7 +179,7 @@ mod tests {
}
#[test]
fn test_push_force() {
fn push_force() {
assert_eq!(
Command::parse_line("push +src:dst").unwrap(),
Line::Valid(Command::Push("+src:dst".to_owned()))
@@ -187,7 +187,7 @@ mod tests {
}
#[test]
fn test_push_delete() {
fn push_delete() {
assert_eq!(
Command::parse_line("push :dst").unwrap(),
Line::Valid(Command::Push(":dst".to_owned()))
@@ -195,7 +195,7 @@ mod tests {
}
#[test]
fn test_option() {
fn option() {
assert_eq!(
Command::parse_line("option verbosity 2").unwrap(),
Line::Valid(Command::Option {
@@ -206,7 +206,7 @@ mod tests {
}
#[test]
fn test_option_whitespace_preservation() {
fn option_whitespace_preservation() {
assert_eq!(
Command::parse_line("option patch.message Fix: whitespace").unwrap(),
Line::Valid(Command::Option {
@@ -217,13 +217,13 @@ mod tests {
}
#[test]
fn test_empty() {
fn empty() {
assert_eq!(Command::parse_line("").unwrap(), Line::Blank);
assert_eq!(Command::parse_line(" ").unwrap(), Line::Blank);
}
#[test]
fn test_invalid() {
fn invalid() {
assert!(Command::parse_line("invalid command").is_err());
assert!(Command::parse_line("list invalid").is_err());
}
@@ -56,7 +56,7 @@ fn browse_repo_lazily() {
}
#[test]
fn test_file_history() {
fn file_history() {
let repo = Repository::open(platinum::get()).unwrap();
let history = repo.history(Branch::local(refname!("dev"))).unwrap();
let path = Path::new("README.md");
@@ -67,7 +67,7 @@ fn test_file_history() {
}
#[test]
fn test_commit_history() {
fn commit_history() {
let repo = Repository::open(platinum::get()).unwrap();
let head = "a0dd9122d33dff2a35f564d564db127152c88e02";
@@ -82,7 +82,7 @@ fn test_commit_history() {
}
#[test]
fn test_commit_signature() {
fn commit_signature() {
let repo = Repository::open(platinum::get()).unwrap();
let commit_with_signature = "e24124b7538658220b5aaf3b6ef53758f0a106dc";
let signature = repo.extract_signature(commit_with_signature, None).unwrap();
+11 -11
View File
@@ -14,7 +14,7 @@ use crate::{
use super::platinum;
#[test]
fn test_initial_diff() -> Result<(), Error> {
fn initial_diff() -> Result<(), Error> {
let repo = Repository::open(platinum::get())?;
let oid = Oid::from_str("d3464e33d75c75c99bfb90fa2e9d16efc0b7d0e3")?;
let commit = repo.commit(oid).unwrap();
@@ -63,7 +63,7 @@ fn test_initial_diff() -> Result<(), Error> {
}
#[test]
fn test_diff_of_rev() -> Result<(), Error> {
fn diff_of_rev() -> Result<(), Error> {
let repo = Repository::open(platinum::get())?;
let diff = repo.diff_commit("80bacafba303bf0cdf6142921f430ff265f25095")?;
assert_eq!(diff.files().count(), 1);
@@ -71,7 +71,7 @@ fn test_diff_of_rev() -> Result<(), Error> {
}
#[test]
fn test_diff_file() -> Result<(), Error> {
fn diff_file() -> Result<(), Error> {
let repo = Repository::open(platinum::get())?;
let path_buf = Path::new("README.md").to_path_buf();
let diff = repo.diff_file(
@@ -114,7 +114,7 @@ fn test_diff_file() -> Result<(), Error> {
}
#[test]
fn test_diff() -> Result<(), Error> {
fn diff() -> Result<(), Error> {
let repo = Repository::open(platinum::get())?;
let oid = "80bacafba303bf0cdf6142921f430ff265f25095";
let commit = repo.commit(oid).unwrap();
@@ -164,7 +164,7 @@ fn test_diff() -> Result<(), Error> {
}
#[test]
fn test_branch_diff() -> Result<(), Error> {
fn branch_diff() -> Result<(), Error> {
let repo = Repository::open(platinum::get())?;
let rev_from = Branch::local(refname!("master"));
let rev_to = Branch::local(refname!("dev"));
@@ -215,7 +215,7 @@ fn test_branch_diff() -> Result<(), Error> {
#[cfg(feature = "serde")]
#[test]
fn test_diff_serde() -> Result<(), Error> {
fn diff_serde() -> Result<(), Error> {
let repo = Repository::open(platinum::get())?;
let rev_from = Branch::local(refname!("master"));
let rev_to = Branch::local(refname!("diff-test"));
@@ -385,7 +385,7 @@ fn test_diff_serde() -> Result<(), Error> {
#[cfg(feature = "serde")]
#[test]
fn test_rename_with_changes() {
fn rename_with_changes() {
let buf = r"
diff --git a/radicle/src/node/tracking/config.rs b/radicle-node/src/service/tracking.rs
similarity index 96%
@@ -595,7 +595,7 @@ index 3f69208f3..cbc843c82 100644
// https://github.com/rust-lang/rust-clippy/issues/11402
#[allow(clippy::needless_raw_string_hashes)]
#[test]
fn test_both_missing_eof_newline() {
fn both_missing_eof_newline() {
let buf = r#"
diff --git a/.env b/.env
index f89e4c0..7c56eb7 100644
@@ -616,7 +616,7 @@ index f89e4c0..7c56eb7 100644
}
#[test]
fn test_none_missing_eof_newline() {
fn none_missing_eof_newline() {
let buf = r#"
diff --git a/.env b/.env
index f89e4c0..7c56eb7 100644
@@ -635,7 +635,7 @@ index f89e4c0..7c56eb7 100644
}
#[test]
fn test_old_missing_eof_newline() {
fn old_missing_eof_newline() {
let buf = r#"
diff --git a/.env b/.env
index f89e4c0..7c56eb7 100644
@@ -655,7 +655,7 @@ index f89e4c0..7c56eb7 100644
}
#[test]
fn test_new_missing_eof_newline() {
fn new_missing_eof_newline() {
let buf = r#"
diff --git a/.env b/.env
index f89e4c0..7c56eb7 100644
+3 -3
View File
@@ -4,7 +4,7 @@ use radicle_git_ref_format::pattern;
use super::platinum;
#[test]
fn test_branches() {
fn branches() {
let repo = Repository::open(platinum::get()).unwrap();
let heads = Glob::all_heads();
let branches = repo.branches(heads.clone()).unwrap();
@@ -20,7 +20,7 @@ fn test_branches() {
}
#[test]
fn test_tag_snapshot() {
fn tag_snapshot() {
let repo = Repository::open(platinum::get()).unwrap();
let tags = repo
.tags(&Glob::all_tags())
@@ -33,7 +33,7 @@ fn test_tag_snapshot() {
}
#[test]
fn test_namespaces() {
fn namespaces() {
let repo = Repository::open(platinum::get()).unwrap();
let namespaces = repo.namespaces(&Glob::all_namespaces()).unwrap();
+1 -1
View File
@@ -56,7 +56,7 @@ fn tree_serialization() {
}
#[test]
fn test_tree_last_commit() {
fn tree_last_commit() {
let repo = Repository::open(platinum::get()).unwrap();
let tree = repo.tree(refname!("refs/heads/master"), &"src").unwrap();
let last_commit = tree.last_commit(&repo).unwrap();
+2 -2
View File
@@ -11,7 +11,7 @@ use super::r#gen;
proptest! {
#[test]
fn test_submodule(
fn submodule(
initial in r#gen::commit::commit(),
commits in collection::vec(r#gen::commit::commit(), 1..5)
) {
@@ -20,7 +20,7 @@ proptest! {
#[ignore = "segfault"]
#[test]
fn test_submodule_bare(
fn submodule_bare(
initial in r#gen::commit::commit(),
commits in collection::vec(r#gen::commit::commit(), 1..5)
) {
+1 -1
View File
@@ -210,7 +210,7 @@ impl<T: Cell + fmt::Display> Cell for Filled<T> {
#[cfg(test)]
mod test {
#[test]
fn test_width() {
fn width() {
assert_eq!(unicode_display_width::width("❤️"), 2);
assert_eq!(unicode_display_width::width("🪵"), 2);
}
+3 -3
View File
@@ -378,7 +378,7 @@ mod test {
use super::*;
#[test]
fn test_truncate() {
fn truncate() {
let line = Line::default().item("banana").item("peach").item("apple");
let mut actual = line.clone();
@@ -399,7 +399,7 @@ mod test {
}
#[test]
fn test_width() {
fn width() {
// Nb. This might not display correctly in some editors or terminals.
let line = Line::new("Radicle Heartwood Protocol & Stack ❤️🪵");
assert_eq!(line.width(), 39, "{line}");
@@ -410,7 +410,7 @@ mod test {
}
#[test]
fn test_spaced() {
fn spaced() {
let line = Line::spaced(["banana", "peach", "apple"].into_iter().map(Label::new));
let iterated: Vec<_> = line.into_iter().collect();
+8 -8
View File
@@ -259,7 +259,7 @@ mod test {
use pretty_assertions::assert_eq;
#[test]
fn test_truncate() {
fn truncate() {
assert_eq!("🍍".truncate(1, "…"), String::from("…"));
assert_eq!("🍍".truncate(1, ""), String::from(""));
assert_eq!("🍍🍍".truncate(2, "…"), String::from("…"));
@@ -272,7 +272,7 @@ mod test {
}
#[test]
fn test_table() {
fn table() {
let mut t = Table::new(TableOptions::default());
t.push(["pineapple", "rosemary"]);
@@ -289,7 +289,7 @@ mod test {
}
#[test]
fn test_table_border() {
fn table_border() {
let mut t = Table::new(TableOptions {
border: Some(Color::Unset),
spacing: 3,
@@ -326,7 +326,7 @@ mod test {
}
#[test]
fn test_table_border_truncated() {
fn table_border_truncated() {
let mut t = Table::new(TableOptions {
border: Some(Color::Unset),
spacing: 3,
@@ -367,7 +367,7 @@ mod test {
}
#[test]
fn test_table_border_maximized() {
fn table_border_maximized() {
let mut t = Table::new(TableOptions {
border: Some(Color::Unset),
spacing: 3,
@@ -411,7 +411,7 @@ mod test {
}
#[test]
fn test_table_truncate() {
fn table_truncate() {
let mut t = Table::default();
let constrain = Constraint::new(
Size::MIN,
@@ -435,7 +435,7 @@ mod test {
}
#[test]
fn test_table_unicode() {
fn table_unicode() {
let mut t = Table::new(TableOptions::default());
t.push(["🍍pineapple", "__rosemary", "__sage"]);
@@ -452,7 +452,7 @@ mod test {
}
#[test]
fn test_table_unicode_truncate() {
fn table_unicode_truncate() {
let mut t = Table::new(TableOptions {
..TableOptions::default()
});
+4 -4
View File
@@ -98,7 +98,7 @@ mod test {
use pretty_assertions::assert_eq;
#[test]
fn test_wrapping() {
fn wrapping() {
let t = TextArea::new(
"Radicle enables users to run their own nodes, \
ensuring censorship-resistant code collaboration \
@@ -120,7 +120,7 @@ mod test {
}
#[test]
fn test_wrapping_paragraphs() {
fn wrapping_paragraphs() {
let t = TextArea::new(
"Radicle enables users to run their own nodes, \
ensuring censorship-resistant code collaboration \
@@ -151,7 +151,7 @@ mod test {
}
#[test]
fn test_wrapping_code_block() {
fn wrapping_code_block() {
let t = TextArea::new(
"\
Here's an example:
@@ -179,7 +179,7 @@ Run the above and wait for your project to sync.\
}
#[test]
fn test_wrapping_fenced_block() {
fn wrapping_fenced_block() {
let t = TextArea::new(
"\
Here's an example:
+2 -2
View File
@@ -215,7 +215,7 @@ mod test {
use pretty_assertions::assert_eq;
#[test]
fn test_vstack() {
fn vstack() {
let mut v = VStack::default().border(Some(Color::Unset)).padding(1);
v.push(Line::new("banana"));
@@ -245,7 +245,7 @@ mod test {
}
#[test]
fn test_vstack_maximize() {
fn vstack_maximize() {
let mut v = VStack::default().border(Some(Color::Unset)).padding(1);
v.push(Line::new("banana"));
+2 -2
View File
@@ -449,7 +449,7 @@ mod tests {
use crate::assert_matches;
#[test]
fn test_check_version() {
fn check_version() {
let mut db = StoreWriter::memory().unwrap();
assert_matches!(db.check_version(), Err(Error::OutOfDate));
@@ -458,7 +458,7 @@ mod tests {
}
#[test]
fn test_migrate_to() {
fn migrate_to() {
let mut db = StoreWriter::memory().unwrap();
assert_eq!(db.version().unwrap(), 0);
+2 -2
View File
@@ -86,7 +86,7 @@ mod tests {
const PATCH_V2: &str = include_str!("samples/patch.v2.json");
#[test]
fn test_migration_2() {
fn migration_2() {
let mut db = StoreWriter::memory().unwrap();
db.migrate_to(1, migrate::ignore).unwrap();
db.raw_query(|conn| {
@@ -125,7 +125,7 @@ mod tests {
}
#[test]
fn test_patch_json_deserialization() {
fn patch_json_deserialization() {
serde_json::from_str::<crate::cob::patch::Patch>(PATCH_V1).unwrap_err();
serde_json::from_str::<crate::cob::patch::Patch>(PATCH_V2).unwrap();
}
+3 -3
View File
@@ -525,7 +525,7 @@ mod test {
use super::*;
#[test]
fn test_title() {
fn title() {
assert_eq!(Title::new(""), Err(TitleError::EmptyTitle));
assert_eq!(Title::new(" "), Err(TitleError::EmptyTitle));
assert_eq!(Title::new("\t"), Err(TitleError::EmptyTitle));
@@ -535,7 +535,7 @@ mod test {
}
#[test]
fn test_color() {
fn color() {
let c = Color::from_str("#ffccaa").unwrap();
assert_eq!(c.to_string(), "#ffccaa".to_owned());
assert_eq!(serde_json::to_string(&c).unwrap(), "\"#ffccaa\"".to_owned());
@@ -555,7 +555,7 @@ mod test {
}
#[test]
fn test_emojis() {
fn emojis() {
let emojis = emojis::Group::SmileysAndEmotion
.emojis()
.chain(emojis::Group::PeopleAndBody.emojis())
+7 -7
View File
@@ -1398,7 +1398,7 @@ mod test {
}
#[test]
fn test_identity_updates() {
fn identity_updates() {
let NodeWithRepo { node, repo } = NodeWithRepo::default();
let bob = SigningKey::mock(103);
let signer = &node.signer;
@@ -1461,7 +1461,7 @@ mod test {
}
#[test]
fn test_identity_update_rejected() {
fn identity_update_rejected() {
let NodeWithRepo { node, repo } = NodeWithRepo::default();
let bob = SigningKey::mock(200);
let eve = SigningKey::mock(201);
@@ -1541,7 +1541,7 @@ mod test {
}
#[test]
fn test_identity_updates_concurrent() {
fn identity_updates_concurrent() {
let network = Network::default();
let alice = &network.alice;
let bob = &network.bob;
@@ -1613,7 +1613,7 @@ mod test {
}
#[test]
fn test_identity_redact_revision() {
fn identity_redact_revision() {
let network = Network::default();
let alice = &network.alice;
let bob = &network.bob;
@@ -1972,7 +1972,7 @@ mod test {
}
#[test]
fn test_identity_updates_concurrent_outdated() {
fn identity_updates_concurrent_outdated() {
let network = Network::default();
let alice = &network.alice;
let bob = &network.bob;
@@ -2253,7 +2253,7 @@ mod test {
}
#[test]
fn test_identity_cannot_redact_terminal_states() {
fn identity_cannot_redact_terminal_states() {
let network = Network::default();
let alice = &network.alice;
let bob = &network.bob;
@@ -2571,7 +2571,7 @@ mod test {
}
#[test]
fn test_valid_identity() {
fn valid_identity() {
let tempdir = tempfile::tempdir().unwrap();
let mut rng = fastrand::Rng::new();
+23 -23
View File
@@ -945,7 +945,7 @@ mod test {
use crate::{assert_matches, test};
#[test]
fn test_concurrency() {
fn concurrency() {
let t = test::setup::Network::default();
let mut alice_issues = Cache::no_cache(&*t.alice.repo, &t.alice.signer).unwrap();
@@ -1016,7 +1016,7 @@ mod test {
}
#[test]
fn test_ordering() {
fn ordering() {
assert!(CloseReason::Solved > CloseReason::Other);
assert!(
State::Open
@@ -1027,7 +1027,7 @@ mod test {
}
#[test]
fn test_issue_create_and_assign() {
fn issue_create_and_assign() {
let test::setup::NodeWithRepo { node, repo, .. } = test::setup::NodeWithRepo::default();
let mut issues = Cache::no_cache(&*repo, &node.signer).unwrap();
@@ -1063,7 +1063,7 @@ mod test {
}
#[test]
fn test_issue_create_and_reassign() {
fn issue_create_and_reassign() {
let test::setup::NodeWithRepo { node, repo, .. } = test::setup::NodeWithRepo::default();
let mut issues = Cache::no_cache(&*repo, &node.signer).unwrap();
@@ -1095,7 +1095,7 @@ mod test {
}
#[test]
fn test_issue_create_and_get() {
fn issue_create_and_get() {
let test::setup::NodeWithRepo { node, repo, .. } = test::setup::NodeWithRepo::default();
let mut issues = Cache::no_cache(&*repo, &node.signer).unwrap();
let created = issues
@@ -1120,7 +1120,7 @@ mod test {
}
#[test]
fn test_issue_create_and_change_state() {
fn issue_create_and_change_state() {
let test::setup::NodeWithRepo { node, repo, .. } = test::setup::NodeWithRepo::default();
let mut issues = Cache::no_cache(&*repo, &node.signer).unwrap();
let mut issue = issues
@@ -1156,7 +1156,7 @@ mod test {
}
#[test]
fn test_issue_create_and_unassign() {
fn issue_create_and_unassign() {
let test::setup::NodeWithRepo { node, repo, .. } = test::setup::NodeWithRepo::default();
let mut issues = Cache::no_cache(&*repo, &node.signer).unwrap();
@@ -1183,7 +1183,7 @@ mod test {
}
#[test]
fn test_issue_edit() {
fn issue_edit() {
let test::setup::NodeWithRepo { node, repo, .. } = test::setup::NodeWithRepo::default();
let mut issues = Cache::no_cache(&*repo, &node.signer).unwrap();
@@ -1207,7 +1207,7 @@ mod test {
}
#[test]
fn test_issue_edit_description() {
fn issue_edit_description() {
let test::setup::NodeWithRepo { node, repo, .. } = test::setup::NodeWithRepo::default();
let mut issues = Cache::no_cache(&*repo, &node.signer).unwrap();
let mut issue = issues
@@ -1232,7 +1232,7 @@ mod test {
}
#[test]
fn test_issue_react() {
fn issue_react() {
let test::setup::NodeWithRepo { node, repo, .. } = test::setup::NodeWithRepo::default();
let mut issues = Cache::no_cache(&*repo, &node.signer).unwrap();
let mut issue = issues
@@ -1261,7 +1261,7 @@ mod test {
}
#[test]
fn test_issue_reply() {
fn issue_reply() {
let test::setup::NodeWithRepo { node, repo, .. } = test::setup::NodeWithRepo::default();
let mut issues = Cache::no_cache(&*repo, &node.signer).unwrap();
let mut issue = issues
@@ -1307,7 +1307,7 @@ mod test {
}
#[test]
fn test_issue_label() {
fn issue_label() {
let test::setup::NodeWithRepo { node, repo, .. } = test::setup::NodeWithRepo::default();
let mut issues = Cache::no_cache(&*repo, &node.signer).unwrap();
let bug_label = Label::new("bug").unwrap();
@@ -1338,7 +1338,7 @@ mod test {
}
#[test]
fn test_issue_comment() {
fn issue_comment() {
let test::setup::NodeWithRepo { node, repo, .. } = test::setup::NodeWithRepo::default();
let author = node.signer.public_key();
let mut issues = Cache::no_cache(&*repo, &node.signer).unwrap();
@@ -1374,7 +1374,7 @@ mod test {
}
#[test]
fn test_issue_comment_redact() {
fn issue_comment_redact() {
let test::setup::NodeWithRepo { node, repo, .. } = test::setup::NodeWithRepo::default();
let mut issues = Cache::no_cache(&*repo, &node.signer).unwrap();
let mut issue = issues
@@ -1403,7 +1403,7 @@ mod test {
}
#[test]
fn test_issue_state_serde() {
fn issue_state_serde() {
assert_eq!(
serde_json::to_value(State::Open).unwrap(),
serde_json::json!({ "status": "open" })
@@ -1419,7 +1419,7 @@ mod test {
}
#[test]
fn test_issue_all() {
fn issue_all() {
let test::setup::NodeWithRepo { node, repo, .. } = test::setup::NodeWithRepo::default();
let mut issues = Cache::no_cache(&*repo, &node.signer).unwrap();
issues
@@ -1447,7 +1447,7 @@ mod test {
}
#[test]
fn test_issue_multilines() {
fn issue_multilines() {
let test::setup::NodeWithRepo { node, repo, .. } = test::setup::NodeWithRepo::default();
let mut issues = Cache::no_cache(&*repo, &node.signer).unwrap();
let created = issues
@@ -1472,7 +1472,7 @@ mod test {
}
#[test]
fn test_embeds() {
fn embeds() {
let test::setup::NodeWithRepo { node, repo, .. } = test::setup::NodeWithRepo::default();
let mut issues = Cache::no_cache(&*repo, &node.signer).unwrap();
@@ -1525,7 +1525,7 @@ mod test {
}
#[test]
fn test_embeds_edit() {
fn embeds_edit() {
let test::setup::NodeWithRepo { node, repo, .. } = test::setup::NodeWithRepo::default();
let mut issues = Cache::no_cache(&*repo, &node.signer).unwrap();
@@ -1573,7 +1573,7 @@ mod test {
}
#[test]
fn test_invalid_actions() {
fn invalid_actions() {
let test::setup::NodeWithRepo { node, repo, .. } = test::setup::NodeWithRepo::default();
let mut issues = Cache::no_cache(&*repo, &node.signer).unwrap();
let mut issue = issues
@@ -1604,7 +1604,7 @@ mod test {
}
#[test]
fn test_invalid_tx() {
fn invalid_tx() {
let test::setup::NodeWithRepo { node, repo, .. } = test::setup::NodeWithRepo::default();
let mut issues = Cache::no_cache(&*repo, &node.signer).unwrap();
let mut issue = issues
@@ -1630,7 +1630,7 @@ mod test {
}
#[test]
fn test_invalid_tx_reference() {
fn invalid_tx_reference() {
let test::setup::NodeWithRepo { node, repo, .. } = test::setup::NodeWithRepo::default();
let mut issues = Cache::no_cache(&*repo, &node.signer).unwrap();
let issue = issues
@@ -1652,7 +1652,7 @@ mod test {
}
#[test]
fn test_invalid_cob() {
fn invalid_cob() {
use cob::change::Storage as _;
use cob::object::Storage as _;
use nonempty::NonEmpty;
+6 -6
View File
@@ -642,7 +642,7 @@ mod tests {
}
#[test]
fn test_is_empty() {
fn is_empty() {
let repo = arbitrary::r#gen::<MockRepository>(1);
let mut cache = memory(&repo);
assert!(cache.is_empty().unwrap());
@@ -664,7 +664,7 @@ mod tests {
}
#[test]
fn test_counts() {
fn counts() {
let repo = arbitrary::r#gen::<MockRepository>(1);
let mut cache = memory(&repo);
let n_open = arbitrary::r#gen::<u8>(0);
@@ -705,7 +705,7 @@ mod tests {
}
#[test]
fn test_get() {
fn get() {
let repo = arbitrary::r#gen::<MockRepository>(1);
let mut cache = memory(&repo);
let ids = (0..arbitrary::r#gen::<u8>(1))
@@ -740,7 +740,7 @@ mod tests {
}
#[test]
fn test_list() {
fn list() {
let repo = arbitrary::r#gen::<MockRepository>(1);
let mut cache = memory(&repo);
let ids = (0..arbitrary::r#gen::<u8>(1))
@@ -770,7 +770,7 @@ mod tests {
}
#[test]
fn test_list_by_status() {
fn list_by_status() {
let repo = arbitrary::r#gen::<MockRepository>(1);
let mut cache = memory(&repo);
let ids = (0..arbitrary::r#gen::<u8>(1))
@@ -800,7 +800,7 @@ mod tests {
}
#[test]
fn test_remove() {
fn remove() {
let repo = arbitrary::r#gen::<MockRepository>(1);
let mut cache = memory(&repo);
let ids = (0..arbitrary::r#gen::<u8>(1))
+24 -24
View File
@@ -3068,7 +3068,7 @@ mod test {
}
#[test]
fn test_target_branch() {
fn target_branch() {
let unqualified = TargetBranch::try_from("master").unwrap();
assert_eq!(unqualified.as_str(), "refs/heads/master");
@@ -3092,7 +3092,7 @@ mod test {
}
#[test]
fn test_json_serialisation_target() {
fn json_serialisation_target() {
let edit_none = Action::Edit {
title: cob::Title::new("My patch").unwrap(),
target: MergeTarget::Delegates,
@@ -3115,7 +3115,7 @@ mod test {
}
#[test]
fn test_merge_target_resolution() {
fn merge_target_resolution() {
let alice = SigningKey::mock(23);
let project = Project::new(
ProjectName::from_str("test_merge_target_resolution").unwrap(),
@@ -3170,7 +3170,7 @@ mod test {
}
#[test]
fn test_patch_merge_authorization_ref_formats() {
fn patch_merge_authorization_ref_formats() {
let base = git::Oid::from_str("cb18e95ada2bb38aadd8e6cef0963ce37a87add3").unwrap();
let oid = git::Oid::from_str("518d5069f94c03427f694bb494ac1cd7d1339380").unwrap();
let alice = SigningKey::mock(14);
@@ -3253,7 +3253,7 @@ mod test {
}
#[test]
fn test_patch_merge_custom_destination_authorized() {
fn patch_merge_custom_destination_authorized() {
let base = git::Oid::from_str("cb18e95ada2bb38aadd8e6cef0963ce37a87add3").unwrap();
let oid = git::Oid::from_str("518d5069f94c03427f694bb494ac1cd7d1339380").unwrap();
let alice = SigningKey::mock(14);
@@ -3312,7 +3312,7 @@ mod test {
}
#[test]
fn test_patch_merge_custom_destination_unauthorized() {
fn patch_merge_custom_destination_unauthorized() {
let base = git::Oid::from_str("cb18e95ada2bb38aadd8e6cef0963ce37a87add3").unwrap();
let oid = git::Oid::from_str("518d5069f94c03427f694bb494ac1cd7d1339380").unwrap();
let alice = SigningKey::mock(14);
@@ -3371,7 +3371,7 @@ mod test {
}
#[test]
fn test_json_serialization() {
fn json_serialization() {
let edit = Action::Label {
labels: BTreeSet::new(),
};
@@ -3382,7 +3382,7 @@ mod test {
}
#[test]
fn test_reactions_json_serialization() {
fn reactions_json_serialization() {
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
struct TestReactions {
@@ -3424,7 +3424,7 @@ mod test {
}
#[test]
fn test_patch_create_and_get() {
fn patch_create_and_get() {
let alice = test::setup::NodeWithRepo::default();
let checkout = alice.repo.checkout();
let branch = checkout.branch_with([("README", b"Hello World!")]);
@@ -3465,7 +3465,7 @@ mod test {
}
#[test]
fn test_patch_discussion() {
fn patch_discussion() {
let alice = test::setup::NodeWithRepo::default();
let checkout = alice.repo.checkout();
let branch = checkout.branch_with([("README", b"Hello World!")]);
@@ -3497,7 +3497,7 @@ mod test {
}
#[test]
fn test_patch_merge() {
fn patch_merge() {
let alice = test::setup::NodeWithRepo::default();
let checkout = alice.repo.checkout();
let branch = checkout.branch_with([("README", b"Hello World!")]);
@@ -3527,7 +3527,7 @@ mod test {
}
#[test]
fn test_patch_review() {
fn patch_review() {
let alice = test::setup::NodeWithRepo::default();
let checkout = alice.repo.checkout();
let branch = checkout.branch_with([("README", b"Hello World!")]);
@@ -3577,7 +3577,7 @@ mod test {
}
#[test]
fn test_patch_review_revision_redact() {
fn patch_review_revision_redact() {
let alice = test::setup::NodeWithRepo::default();
let checkout = alice.repo.checkout();
let branch = checkout.branch_with([("README", b"Hello World!")]);
@@ -3607,7 +3607,7 @@ mod test {
}
#[test]
fn test_revision_review_merge_redacted() {
fn revision_review_merge_redacted() {
let base = git::Oid::from_str("cb18e95ada2bb38aadd8e6cef0963ce37a87add3").unwrap();
let oid = git::Oid::from_str("518d5069f94c03427f694bb494ac1cd7d1339380").unwrap();
let mut alice = SigningKey::mock(14);
@@ -3665,7 +3665,7 @@ mod test {
}
#[test]
fn test_revision_edit_redact() {
fn revision_edit_redact() {
let base = arbitrary::oid();
let oid = arbitrary::oid();
let repo = r#gen::<MockRepository>(1);
@@ -3726,7 +3726,7 @@ mod test {
}
#[test]
fn test_revision_reaction() {
fn revision_reaction() {
let base = git::Oid::from_str("cb18e95ada2bb38aadd8e6cef0963ce37a87add3").unwrap();
let oid = git::Oid::from_str("518d5069f94c03427f694bb494ac1cd7d1339380").unwrap();
let mut alice = SigningKey::mock(35);
@@ -3764,7 +3764,7 @@ mod test {
}
#[test]
fn test_patch_review_edit() {
fn patch_review_edit() {
let alice = test::setup::NodeWithRepo::default();
let checkout = alice.repo.checkout();
let branch = checkout.branch_with([("README", b"Hello World!")]);
@@ -3801,7 +3801,7 @@ mod test {
}
#[test]
fn test_patch_review_duplicate() {
fn patch_review_duplicate() {
let alice = test::setup::NodeWithRepo::default();
let checkout = alice.repo.checkout();
let branch = checkout.branch_with([("README", b"Hello World!")]);
@@ -3831,7 +3831,7 @@ mod test {
}
#[test]
fn test_patch_review_edit_comment() {
fn patch_review_edit_comment() {
let alice = test::setup::NodeWithRepo::default();
let checkout = alice.repo.checkout();
let branch = checkout.branch_with([("README", b"Hello World!")]);
@@ -3880,7 +3880,7 @@ mod test {
}
#[test]
fn test_patch_review_comment() {
fn patch_review_comment() {
let alice = test::setup::NodeWithRepo::default();
let checkout = alice.repo.checkout();
let branch = checkout.branch_with([("README", b"Hello World!")]);
@@ -3925,7 +3925,7 @@ mod test {
}
#[test]
fn test_patch_review_remove_summary() {
fn patch_review_remove_summary() {
let alice = test::setup::NodeWithRepo::default();
let checkout = alice.repo.checkout();
let branch = checkout.branch_with([("README", b"Hello World!")]);
@@ -3965,7 +3965,7 @@ mod test {
}
#[test]
fn test_patch_update() {
fn patch_update() {
let alice = test::setup::NodeWithRepo::default();
let checkout = alice.repo.checkout();
let branch = checkout.branch_with([("README", b"Hello World!")]);
@@ -4019,7 +4019,7 @@ mod test {
}
#[test]
fn test_patch_redact() {
fn patch_redact() {
let alice = test::setup::Node::default();
let repo = alice.project();
let branch = repo
@@ -4056,7 +4056,7 @@ mod test {
}
#[test]
fn test_json() {
fn json() {
use serde_json::json;
assert_eq!(
+1 -1
View File
@@ -188,7 +188,7 @@ mod test {
use super::ReviewEdit;
#[test]
fn test_review_edit() {
fn review_edit() {
let v1 = json!({
"type": "review.edit",
"review": "89d45fb371eb2622ba88188d474347cc526d80bb",
+7 -7
View File
@@ -766,7 +766,7 @@ mod tests {
}
#[test]
fn test_is_empty() {
fn is_empty() {
let repo = arbitrary::r#gen::<MockRepository>(1);
let mut cache = memory(&repo);
assert!(cache.is_empty().unwrap());
@@ -794,7 +794,7 @@ mod tests {
}
#[test]
fn test_counts() {
fn counts() {
let repo = arbitrary::r#gen::<MockRepository>(1);
let mut cache = memory(&repo);
let n_open = arbitrary::r#gen::<u8>(0);
@@ -882,7 +882,7 @@ mod tests {
}
#[test]
fn test_get() {
fn get() {
let repo = arbitrary::r#gen::<MockRepository>(1);
let mut cache = memory(&repo);
let ids = (0..arbitrary::r#gen::<u8>(1))
@@ -918,7 +918,7 @@ mod tests {
}
#[test]
fn test_find_by_revision() {
fn find_by_revision() {
let repo = arbitrary::r#gen::<MockRepository>(1);
let mut cache = memory(&repo);
let patch_id = PatchId::from(arbitrary::oid());
@@ -960,7 +960,7 @@ mod tests {
}
#[test]
fn test_list() {
fn list() {
let repo = arbitrary::r#gen::<MockRepository>(1);
let mut cache = memory(&repo);
let ids = (0..arbitrary::r#gen::<u8>(1))
@@ -991,7 +991,7 @@ mod tests {
}
#[test]
fn test_list_by_status() {
fn list_by_status() {
let repo = arbitrary::r#gen::<MockRepository>(1);
let mut cache = memory(&repo);
let ids = (0..arbitrary::r#gen::<u8>(1))
@@ -1022,7 +1022,7 @@ mod tests {
}
#[test]
fn test_remove() {
fn remove() {
let repo = arbitrary::r#gen::<MockRepository>(1);
let mut cache = memory(&repo);
let ids = (0..arbitrary::r#gen::<u8>(1))
@@ -134,7 +134,7 @@ mod test {
use super::{Review, Summary};
#[test]
fn test_review_summary() {
fn review_summary() {
let summary_null = json!(null);
let summary_string = json!("lgtm");
let summary_edits = json!([{
@@ -165,7 +165,7 @@ mod test {
}
#[test]
fn test_review_deserialize_summary_migration_null_summary() {
fn review_deserialize_summary_migration_null_summary() {
let review = json!({
"id": "89d45fb371eb2622ba88188d474347cc526d80bb",
"author": { "id": "did:key:z6MkwPUeUS2fJMfc2HZN1RQTQcTTuhw4HhPySB8JeUg2mVvx" },
@@ -186,7 +186,7 @@ mod test {
}
#[test]
fn test_review_deserialize_summary_migration_without_summary() {
fn review_deserialize_summary_migration_without_summary() {
let review = json!({
"id": "89d45fb371eb2622ba88188d474347cc526d80bb",
"author": { "id": "did:key:z6MkwPUeUS2fJMfc2HZN1RQTQcTTuhw4HhPySB8JeUg2mVvx" },
@@ -206,7 +206,7 @@ mod test {
}
#[test]
fn test_review_deserialize_summary_migration_with_summary() {
fn review_deserialize_summary_migration_with_summary() {
let review = json!({
"id": "89d45fb371eb2622ba88188d474347cc526d80bb",
"author": { "id": "did:key:z6MkwPUeUS2fJMfc2HZN1RQTQcTTuhw4HhPySB8JeUg2mVvx" },
@@ -227,7 +227,7 @@ mod test {
}
#[test]
fn test_review_deserialize_summary_v2() {
fn review_deserialize_summary_v2() {
let review = json!({
"id": "89d45fb371eb2622ba88188d474347cc526d80bb",
"author": { "id": "did:key:z6MkwPUeUS2fJMfc2HZN1RQTQcTTuhw4HhPySB8JeUg2mVvx" },
+5 -5
View File
@@ -329,7 +329,7 @@ mod tests {
}
#[test]
fn test_all_from() {
fn all_from() {
let tmp = tempfile::tempdir().unwrap();
let (repo, _) = test::fixtures::repository(tmp.path());
let signer = SigningKey::mock(38);
@@ -343,7 +343,7 @@ mod tests {
}
#[test]
fn test_all_until() {
fn all_until() {
let tmp = tempfile::tempdir().unwrap();
let (repo, _) = test::fixtures::repository(tmp.path());
let signer = SigningKey::mock(39);
@@ -358,7 +358,7 @@ mod tests {
}
#[test]
fn test_all_from_until() {
fn all_from_until() {
let tmp = tempfile::tempdir().unwrap();
let (repo, _) = test::fixtures::repository(tmp.path());
let signer = SigningKey::mock(40);
@@ -373,7 +373,7 @@ mod tests {
}
#[test]
fn test_from_until() {
fn from_until() {
let tmp = tempfile::tempdir().unwrap();
let (repo, _) = test::fixtures::repository(tmp.path());
let signer = SigningKey::mock(41);
@@ -396,7 +396,7 @@ mod tests {
}
#[test]
fn test_regression_from_until() {
fn regression_from_until() {
let tmp = tempfile::tempdir().unwrap();
let (repo, _) = test::fixtures::repository(tmp.path());
let signer = SigningKey::mock(42);
+7 -7
View File
@@ -664,7 +664,7 @@ mod tests {
impl<T> SignerThreadOpExt for T where T: SignerOpExt {}
#[test]
fn test_redact_comment() {
fn redact_comment() {
let radicle::test::setup::Node { signer, .. } = radicle::test::setup::Node::default();
let repo = r#gen::<MockRepository>(1);
let mut alice = signer;
@@ -689,7 +689,7 @@ mod tests {
}
#[test]
fn test_edit_comment() {
fn edit_comment() {
let mut alice = SigningKey::mock(49);
let repo = r#gen::<MockRepository>(1);
@@ -761,7 +761,7 @@ mod tests {
}
#[test]
fn test_timeline() {
fn timeline() {
let alice = SigningKey::mock(94);
let bob = SigningKey::mock(103);
let eve = SigningKey::mock(104);
@@ -829,7 +829,7 @@ mod tests {
}
#[test]
fn test_duplicate_comments() {
fn duplicate_comments() {
let repo = r#gen::<MockRepository>(1);
let alice = SigningKey::mock(94);
let bob = SigningKey::mock(103);
@@ -934,7 +934,7 @@ mod tests {
}
#[test]
fn test_comment_redact_missing() {
fn comment_redact_missing() {
let repo = r#gen::<MockRepository>(1);
let mut alice = SigningKey::mock(94);
let mut t = Thread::default();
@@ -944,7 +944,7 @@ mod tests {
}
#[test]
fn test_comment_edit_missing() {
fn comment_edit_missing() {
let repo = r#gen::<MockRepository>(1);
let mut alice = SigningKey::mock(94);
let mut t = Thread::default();
@@ -954,7 +954,7 @@ mod tests {
}
#[test]
fn test_comment_edit_redacted() {
fn comment_edit_redacted() {
let repo = r#gen::<MockRepository>(1);
let mut alice = SigningKey::mock(94);
+11 -11
View File
@@ -556,7 +556,7 @@ mod tests {
}
#[test]
fn test_quorum_properties() {
fn quorum_properties() {
let tmp = tempfile::tempdir().unwrap();
let (repo, c0) = fixtures::repository(tmp.path());
let c0: crate::git::Oid = c0.into();
@@ -590,7 +590,7 @@ mod tests {
}
#[test]
fn test_quorum_different_types() {
fn quorum_different_types() {
let tmp = tempfile::tempdir().unwrap();
let (repo, c0) = fixtures::repository(tmp.path());
let t0 = fixtures::tag("v1", "", c0, &repo);
@@ -602,7 +602,7 @@ mod tests {
}
#[test]
fn test_commit_quorum_groups() {
fn commit_quorum_groups() {
let c0 = commit("f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354");
let c1 = commit("bfb1a513e420eade90b0e6be64117b861b16ecb5");
let c2 = commit("8fc5160702365f231c77732a8fa162379e54f57a");
@@ -635,7 +635,7 @@ mod tests {
}
#[test]
fn test_tag_quorum() {
fn tag_quorum() {
let t1 = tag("0480391dd7312d35c79a455ec5d004657260b358");
let t2 = tag("a2eec713ec5c287ecdf13a0180f68acfef7962d0");
@@ -654,7 +654,7 @@ mod tests {
}
#[test]
fn test_commit_quorum_single() {
fn commit_quorum_single() {
let c0 = commit("f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354");
let c1 = commit("bfb1a513e420eade90b0e6be64117b861b16ecb5");
let c2 = commit("8fc5160702365f231c77732a8fa162379e54f57a");
@@ -673,7 +673,7 @@ mod tests {
}
#[test]
fn test_commit_quorum_linear() {
fn commit_quorum_linear() {
let c0 = commit("f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354");
let c1 = commit("bfb1a513e420eade90b0e6be64117b861b16ecb5");
let c2 = commit("8fc5160702365f231c77732a8fa162379e54f57a");
@@ -729,7 +729,7 @@ mod tests {
}
#[test]
fn test_commit_quorum_two_way_fork() {
fn commit_quorum_two_way_fork() {
let c0 = commit("f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354");
let c1 = commit("bfb1a513e420eade90b0e6be64117b861b16ecb5");
let c2 = commit("8fc5160702365f231c77732a8fa162379e54f57a");
@@ -837,7 +837,7 @@ mod tests {
}
#[test]
fn test_commit_quorum_three_way_fork() {
fn commit_quorum_three_way_fork() {
let c1 = commit("bfb1a513e420eade90b0e6be64117b861b16ecb5");
let c2 = commit("8fc5160702365f231c77732a8fa162379e54f57a");
let c3 = commit("07c2a0f856e0d6b08115f98a265df88c4e507fa0");
@@ -917,7 +917,7 @@ mod tests {
}
#[test]
fn test_commit_quorum_fork_of_a_fork() {
fn commit_quorum_fork_of_a_fork() {
let c0 = commit("f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354");
let c1 = commit("bfb1a513e420eade90b0e6be64117b861b16ecb5");
let c2 = commit("8fc5160702365f231c77732a8fa162379e54f57a");
@@ -1200,7 +1200,7 @@ mod tests {
}
#[test]
fn test_commit_quorum_forked_merge_commits() {
fn commit_quorum_forked_merge_commits() {
let c0 = commit("f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354");
let c1 = commit("bfb1a513e420eade90b0e6be64117b861b16ecb5");
let c2 = commit("8fc5160702365f231c77732a8fa162379e54f57a");
@@ -1466,7 +1466,7 @@ mod tests {
}
#[test]
fn test_commit_quorum_merges() {
fn commit_quorum_merges() {
let c2 = commit("8fc5160702365f231c77732a8fa162379e54f57a");
let m1 = commit("dd7ee5bca2fc7288a6efcb4303278e26a2dbaa45");
let m2 = commit("d54e505e3fb5c0c7e4b9a4b8a1cdeefb3fc9ef18");
+1 -1
View File
@@ -269,7 +269,7 @@ mod test {
}
#[test]
fn test_merge_bases() {
fn merge_bases() {
let c0 = commit("f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354");
let c1 = commit("bfb1a513e420eade90b0e6be64117b861b16ecb5");
let c2 = commit("8fc5160702365f231c77732a8fa162379e54f57a");
+2 -2
View File
@@ -108,7 +108,7 @@ mod test {
use super::*;
#[test]
fn test_did_encode_decode() {
fn did_encode_decode() {
let input = "did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK";
let Did(key) = Did::decode(input).unwrap();
@@ -116,7 +116,7 @@ mod test {
}
#[test]
fn test_did_vectors() {
fn did_vectors() {
Did::decode("did:key:z6MkiTBz1ymuepAQ4HEHYSF1H8quG5GLVVQR3djdX3mDooWp").unwrap();
Did::decode("did:key:z6MkjchhfUsD6mmvni8mCdXHw216Xrm9bQe2mBH1P5RDjVJG").unwrap();
Did::decode("did:key:z6MknGc3ocHs3zdPiJbnaaqDi58NGb4pk1Sp9WxWufuXSdxf").unwrap();
+9 -9
View File
@@ -1133,7 +1133,7 @@ mod test {
use qcheck_macros::quickcheck;
#[test]
fn test_duplicate_dids() {
fn duplicate_dids() {
let delegate = SigningKey::mock(usize::MAX);
let did = Did::from(delegate.public_key());
let mut doc = RawDoc::new(r#gen::<Project>(1), vec![did], 1, Visibility::Public);
@@ -1144,7 +1144,7 @@ mod test {
}
#[test]
fn test_max_delegates() {
fn max_delegates() {
// Generate more than the max delegates
let delegates = arbitrary::set::<Did>(MAX_DELEGATES + 1..=MAX_DELEGATES + 1)
.into_iter()
@@ -1165,7 +1165,7 @@ mod test {
}
#[test]
fn test_is_valid_version() {
fn is_valid_version() {
// 0 is not a valid version
assert!(!Version::is_valid_version(&0));
@@ -1180,7 +1180,7 @@ mod test {
}
#[test]
fn test_future_version_error() {
fn future_version_error() {
let v = Version(NonZeroU32::MAX).to_string();
assert_eq!(
serde_json::from_str::<Version>(&v)
@@ -1191,7 +1191,7 @@ mod test {
}
#[test]
fn test_parse_version() {
fn parse_version() {
// Original document before introducing the version field
let v1 = json!(
{
@@ -1265,7 +1265,7 @@ mod test {
}
#[test]
fn test_canonical_example() {
fn canonical_example() {
let tempdir = tempfile::tempdir().unwrap();
let storage = Storage::open(tempdir.path().join("storage"), fixtures::user()).unwrap();
@@ -1296,7 +1296,7 @@ mod test {
}
#[test]
fn test_not_found() {
fn not_found() {
let tempdir = tempfile::tempdir().unwrap();
let storage = Storage::open(tempdir.path().join("storage"), fixtures::user()).unwrap();
let remote = arbitrary::r#gen::<RemoteId>(1);
@@ -1315,7 +1315,7 @@ mod test {
}
#[test]
fn test_canonical_doc() {
fn canonical_doc() {
let tempdir = tempfile::tempdir().unwrap();
let storage = Storage::open(tempdir.path().join("storage"), fixtures::user()).unwrap();
transport::local::register(storage.clone());
@@ -1345,7 +1345,7 @@ mod test {
}
#[test]
fn test_visibility_json() {
fn visibility_json() {
use std::str::FromStr;
assert_eq!(
+3 -3
View File
@@ -305,7 +305,7 @@ mod test {
use super::PayloadUpsert;
#[test]
fn test_can_update_crefs() {
fn can_update_crefs() {
let raw = arbitrary::r#gen::<RawDoc>(1);
let raw = super::payload(
raw,
@@ -326,7 +326,7 @@ mod test {
}
#[test]
fn test_cannot_include_default_branch_rule() {
fn cannot_include_default_branch_rule() {
let raw = arbitrary::r#gen::<RawDoc>(1);
let project = raw.project().unwrap().unwrap();
let branch = project.default_branch_qualified();
@@ -358,7 +358,7 @@ mod test {
}
#[test]
fn test_default_branch_rule_exists_after_verification() {
fn default_branch_rule_exists_after_verification() {
let raw = arbitrary::r#gen::<RawDoc>(1);
let project = raw.project().unwrap().unwrap();
let branch = project.default_branch_qualified();
+1 -1
View File
@@ -283,7 +283,7 @@ mod test {
use crate::assert_matches;
#[test]
fn test_project_name() {
fn project_name() {
assert_matches!(serde_json::from_str::<ProjectName>("\"\""), Err(_));
assert_matches!(
serde_json::from_str::<ProjectName>("\"invalid name\""),
+4 -4
View File
@@ -1592,7 +1592,7 @@ mod test {
use crate::assert_matches;
#[test]
fn test_user_agent() {
fn user_agent() {
assert!(UserAgent::from_str("/radicle:1.0.0/").is_ok());
assert!(UserAgent::from_str("/radicle:1.0.0/heartwood:0.9/").is_ok());
assert!(UserAgent::from_str("/radicle:1.0.0/heartwood:0.9/rust:1.77/").is_ok());
@@ -1614,7 +1614,7 @@ mod test {
}
#[test]
fn test_alias() {
fn alias() {
assert!(Alias::from_str("cloudhead").is_ok());
assert!(Alias::from_str("cloud-head").is_ok());
assert!(Alias::from_str("cl0ud.h3ad$__").is_ok());
@@ -1629,7 +1629,7 @@ mod test {
}
#[test]
fn test_address() {
fn address() {
assert!(Address::from_str("127.0.0.1:8776").is_ok());
assert!(Address::from_str("[::1]:8776").is_ok());
assert!(Address::from_str("[::ffff:127.0.0.1]:8776").is_ok());
@@ -1645,7 +1645,7 @@ mod test {
}
#[test]
fn test_command_result() {
fn command_result() {
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
struct Test {
value: u32,
+13 -13
View File
@@ -622,7 +622,7 @@ mod test {
use localtime::LocalTime;
#[test]
fn test_empty() {
fn empty() {
let tmp = tempfile::tempdir().unwrap();
let path = tmp.path().join("cache");
let cache = Database::open(path, crate::node::db::config::Config::default()).unwrap();
@@ -631,7 +631,7 @@ mod test {
}
#[test]
fn test_get_none() {
fn get_none() {
let alice = arbitrary::r#gen::<NodeId>(1);
let cache = Database::memory().unwrap();
let result = cache.get(&alice).unwrap();
@@ -640,7 +640,7 @@ mod test {
}
#[test]
fn test_remove_nothing() {
fn remove_nothing() {
let alice = arbitrary::r#gen::<NodeId>(1);
let mut cache = Database::memory().unwrap();
let removed = cache.remove(&alice).unwrap();
@@ -649,7 +649,7 @@ mod test {
}
#[test]
fn test_alias() {
fn alias() {
let alice = arbitrary::r#gen::<NodeId>(1);
let mut cache = Database::memory().unwrap();
let features = node::Features::SEED;
@@ -688,7 +688,7 @@ mod test {
}
#[test]
fn test_insert_and_get() {
fn insert_and_get() {
let alice = arbitrary::r#gen::<NodeId>(1);
let mut cache = Database::memory().unwrap();
let version = 2;
@@ -728,7 +728,7 @@ mod test {
}
#[test]
fn test_insert_duplicate() {
fn insert_duplicate() {
let alice = arbitrary::r#gen::<NodeId>(1);
let mut cache = Database::memory().unwrap();
let features = node::Features::SEED;
@@ -757,7 +757,7 @@ mod test {
}
#[test]
fn test_insert_and_update() {
fn insert_and_update() {
let alice = arbitrary::r#gen::<NodeId>(1);
let mut cache = Database::memory().unwrap();
let timestamp = LocalTime::now().into();
@@ -832,7 +832,7 @@ mod test {
}
#[test]
fn test_insert_and_remove() {
fn insert_and_remove() {
let alice = arbitrary::r#gen::<NodeId>(1);
let bob = arbitrary::r#gen::<NodeId>(1);
let mut cache = Database::memory().unwrap();
@@ -882,7 +882,7 @@ mod test {
}
#[test]
fn test_entries() {
fn entries() {
let ids = arbitrary::vec::<NodeId>(16);
let mut rng = fastrand::Rng::new();
let mut cache = Database::memory().unwrap();
@@ -924,7 +924,7 @@ mod test {
}
#[test]
fn test_disconnected() {
fn disconnected() {
let alice = arbitrary::r#gen::<NodeId>(1);
let addr = arbitrary::r#gen::<Address>(1);
let mut cache = Database::memory().unwrap();
@@ -965,7 +965,7 @@ mod test {
}
#[test]
fn test_disconnected_ban() {
fn disconnected_ban() {
let alice = arbitrary::r#gen::<NodeId>(1);
let ua = UserAgent::default();
let ip1: net::Ipv4Addr = [198, 18, 0, 8].into();
@@ -1029,7 +1029,7 @@ mod test {
}
#[test]
fn test_entries_skips_unparsable_address() {
fn entries_skips_unparsable_address() {
let alice = arbitrary::r#gen::<NodeId>(1);
let bob = arbitrary::r#gen::<NodeId>(2);
let mut cache = Database::memory().unwrap();
@@ -1077,7 +1077,7 @@ mod test {
}
#[test]
fn test_node_aliases() {
fn node_aliases() {
let mut db = Database::memory().unwrap();
let input = node::properties::AliasInput::new();
let (short, short_ids) = input.short();
+1 -1
View File
@@ -245,7 +245,7 @@ mod test {
use super::*;
#[test]
fn test_version() {
fn version() {
let n = MIGRATIONS.len();
let db = Database::memory().unwrap();
assert_eq!(db.version().unwrap(), n);
+1 -1
View File
@@ -113,7 +113,7 @@ mod test {
use super::*;
#[test]
fn test_operations() {
fn operations() {
assert_eq!(Features::NONE.with(Features::SEED), Features::SEED);
assert!(
@@ -421,7 +421,7 @@ mod test {
use super::*;
#[test]
fn test_clear() {
fn clear() {
let mut db = Store::open(":memory:").unwrap();
let repo = arbitrary::r#gen::<RepoId>(1);
let old = arbitrary::oid();
@@ -444,7 +444,7 @@ mod test {
}
#[test]
fn test_counts_by_repo() {
fn counts_by_repo() {
let mut db = Store::open(":memory:").unwrap();
let repo1 = arbitrary::r#gen::<RepoId>(1);
let repo2 = arbitrary::r#gen::<RepoId>(1);
@@ -478,7 +478,7 @@ mod test {
}
#[test]
fn test_branch_notifications() {
fn branch_notifications() {
let repo = arbitrary::r#gen::<RepoId>(1);
let old = arbitrary::oid();
let master = arbitrary::oid();
@@ -556,7 +556,7 @@ mod test {
}
#[test]
fn test_notification_status() {
fn notification_status() {
let repo = arbitrary::r#gen::<RepoId>(1);
let oid = arbitrary::oid();
let time = LocalTime::from_millis(32188142);
@@ -599,7 +599,7 @@ mod test {
}
#[test]
fn test_duplicate_notifications() {
fn duplicate_notifications() {
let repo = arbitrary::r#gen::<RepoId>(1);
let old = arbitrary::oid();
let master1 = arbitrary::oid();
@@ -647,7 +647,7 @@ mod test {
}
#[test]
fn test_cob_notifications() {
fn cob_notifications() {
let repo = arbitrary::r#gen::<RepoId>(1);
let old = arbitrary::oid();
let new = arbitrary::oid();
+9 -9
View File
@@ -465,7 +465,7 @@ mod test {
use crate::test::arbitrary;
#[test]
fn test_follow_and_unfollow_node() {
fn follow_and_unfollow_node() {
let id = arbitrary::r#gen::<NodeId>(1);
let mut db = Store::open(":memory:").unwrap();
let eve = Alias::new("eve");
@@ -478,7 +478,7 @@ mod test {
}
#[test]
fn test_seed_and_unseed_repo() {
fn seed_and_unseed_repo() {
let id = arbitrary::r#gen::<RepoId>(1);
let mut db = Store::open(":memory:").unwrap();
@@ -490,7 +490,7 @@ mod test {
}
#[test]
fn test_node_policies() {
fn node_policies() {
let ids = arbitrary::vec::<NodeId>(3);
let mut db = Store::open(":memory:").unwrap();
@@ -504,7 +504,7 @@ mod test {
}
#[test]
fn test_repo_policies() {
fn repo_policies() {
let ids = arbitrary::vec::<RepoId>(3);
let mut db = Store::open(":memory:").unwrap();
@@ -518,7 +518,7 @@ mod test {
}
#[test]
fn test_update_alias() {
fn update_alias() {
let id = arbitrary::r#gen::<NodeId>(1);
let mut db = Store::open(":memory:").unwrap();
@@ -538,7 +538,7 @@ mod test {
}
#[test]
fn test_update_scope() {
fn update_scope() {
let id = arbitrary::r#gen::<RepoId>(1);
let mut db = Store::open(":memory:").unwrap();
@@ -555,7 +555,7 @@ mod test {
}
#[test]
fn test_repo_policy() {
fn repo_policy() {
let id = arbitrary::r#gen::<RepoId>(1);
let mut db = Store::open(":memory:").unwrap();
@@ -567,7 +567,7 @@ mod test {
}
#[test]
fn test_node_policy() {
fn node_policy() {
let id = arbitrary::r#gen::<NodeId>(1);
let mut db = Store::open(":memory:").unwrap();
@@ -584,7 +584,7 @@ mod test {
}
#[test]
fn test_node_aliases() {
fn node_aliases() {
let mut db = Store::open(":memory:").unwrap();
let input = node::properties::AliasInput::new();
let (short, short_ids) = input.short();
+3 -3
View File
@@ -181,7 +181,7 @@ mod test {
use localtime::{LocalDuration, LocalTime};
#[test]
fn test_count() {
fn count() {
let mut db = Database::memory().unwrap();
let oid = arbitrary::oid();
@@ -209,7 +209,7 @@ mod test {
}
#[test]
fn test_set_and_delete() {
fn set_and_delete() {
let mut db = Database::memory().unwrap();
let oid = arbitrary::oid();
@@ -226,7 +226,7 @@ mod test {
}
#[test]
fn test_set_and_get() {
fn set_and_get() {
let mut db = Database::memory().unwrap();
let oid1 = arbitrary::oid();
let oid2 = arbitrary::oid();
+12 -12
View File
@@ -273,7 +273,7 @@ mod test {
}
#[test]
fn test_insert_and_get() {
fn insert_and_get() {
let ids = arbitrary::set::<RepoId>(5..10);
let nodes = arbitrary::set::<NodeId>(5..10);
let mut db = database(":memory:");
@@ -296,7 +296,7 @@ mod test {
}
#[test]
fn test_insert_and_get_resources() {
fn insert_and_get_resources() {
let ids = arbitrary::set::<RepoId>(5..10);
let nodes = arbitrary::set::<NodeId>(5..10);
let mut db = database(":memory:");
@@ -314,7 +314,7 @@ mod test {
}
#[test]
fn test_entries() {
fn entries() {
let ids = arbitrary::set::<RepoId>(6..9);
let nodes = arbitrary::set::<NodeId>(6..9);
let mut db = database(":memory:");
@@ -338,7 +338,7 @@ mod test {
}
#[test]
fn test_insert_and_remove() {
fn insert_and_remove() {
let ids = arbitrary::set::<RepoId>(5..10);
let nodes = arbitrary::set::<NodeId>(5..10);
let mut db = database(":memory:");
@@ -357,7 +357,7 @@ mod test {
}
#[test]
fn test_insert_duplicate() {
fn insert_duplicate() {
let id = arbitrary::r#gen::<RepoId>(1);
let node = arbitrary::r#gen::<NodeId>(1);
let mut db = database(":memory:");
@@ -377,7 +377,7 @@ mod test {
}
#[test]
fn test_insert_existing_updated_time() {
fn insert_existing_updated_time() {
let id = arbitrary::r#gen::<RepoId>(1);
let node = arbitrary::r#gen::<NodeId>(1);
let mut db = database(":memory:");
@@ -398,7 +398,7 @@ mod test {
}
#[test]
fn test_update_existing_multi() {
fn update_existing_multi() {
let id1 = arbitrary::r#gen::<RepoId>(1);
let id2 = arbitrary::r#gen::<RepoId>(1);
let node = arbitrary::r#gen::<NodeId>(1);
@@ -427,7 +427,7 @@ mod test {
}
#[test]
fn test_remove_redundant() {
fn remove_redundant() {
let id = arbitrary::r#gen::<RepoId>(1);
let node = arbitrary::r#gen::<NodeId>(1);
let mut db = database(":memory:");
@@ -441,7 +441,7 @@ mod test {
}
#[test]
fn test_remove_many() {
fn remove_many() {
let id1 = arbitrary::r#gen::<RepoId>(1);
let id2 = arbitrary::r#gen::<RepoId>(1);
let id3 = arbitrary::r#gen::<RepoId>(1);
@@ -457,7 +457,7 @@ mod test {
}
#[test]
fn test_len() {
fn len() {
let mut db = database(":memory:");
let ids = arbitrary::vec::<RepoId>(10);
let node = arbitrary::r#gen(1);
@@ -469,7 +469,7 @@ mod test {
}
#[test]
fn test_prune() {
fn prune() {
let mut rng = fastrand::Rng::new();
let now = LocalTime::now();
let ids = arbitrary::vec::<RepoId>(10);
@@ -503,7 +503,7 @@ mod test {
}
#[test]
fn test_count() {
fn count() {
let id = arbitrary::r#gen::<RepoId>(1);
let nodes = arbitrary::set::<NodeId>(5..10);
let mut db = database(":memory:");
+1 -1
View File
@@ -125,7 +125,7 @@ mod tests {
use super::*;
#[test]
fn test_timestamp_max() {
fn timestamp_max() {
assert_eq!(i64::try_from(*Timestamp::MAX), Ok(i64::MAX));
}
}
+1 -1
View File
@@ -900,7 +900,7 @@ mod test {
}
#[test]
fn test_config() {
fn config() {
let cfg = json::from_value::<Config>(json::json!({
"publicExplorer": "https://app.radicle.example.com/nodes/$host/$rid$path",
"preferredSeeds": [],
+10 -9
View File
@@ -517,7 +517,7 @@ mod tests {
use super::*;
#[test]
fn test_init() {
fn init() {
let tempdir = tempfile::tempdir().unwrap();
let signer = SigningKey::mock(73);
let public_key = signer.public_key();
@@ -526,7 +526,7 @@ mod tests {
transport::local::register(storage.clone());
let (repo, _) = fixtures::repository(tempdir.path().join("working"));
let (proj, _, refs) = init(
let (proj, _, refs) = super::init(
&repo,
"acme".try_into().unwrap(),
"Acme's repo",
@@ -569,7 +569,7 @@ mod tests {
}
#[test]
fn test_fork() {
fn fork() {
let mut rng = fastrand::Rng::new();
let tempdir = tempfile::tempdir().unwrap();
let alice = SigningKey::mock(rng.usize(..));
@@ -581,7 +581,7 @@ mod tests {
// Alice creates a project.
let (original, _) = fixtures::repository(tempdir.path().join("original"));
let (id, _, alice_refs) = init(
let (id, _, alice_refs) = super::init(
&original,
"acme".try_into().unwrap(),
"Acme's repo",
@@ -593,8 +593,8 @@ mod tests {
.unwrap();
// Bob forks it and creates a checkout.
fork(id, &bob, &storage).unwrap();
checkout(id, bob_id, tempdir.path().join("copy"), &storage, false).unwrap();
super::fork(id, &bob, &storage).unwrap();
super::checkout(id, bob_id, tempdir.path().join("copy"), &storage, false).unwrap();
let bob_remote = storage.repository(id).unwrap().remote(bob_id).unwrap();
@@ -608,7 +608,7 @@ mod tests {
}
#[test]
fn test_checkout() {
fn checkout() {
let tempdir = tempfile::tempdir().unwrap();
let signer = SigningKey::mock(73);
let remote_id = signer.public_key();
@@ -617,7 +617,7 @@ mod tests {
transport::local::register(storage.clone());
let (original, _) = fixtures::repository(tempdir.path().join("original"));
let (id, _, _) = init(
let (id, _, _) = super::init(
&original,
"acme".try_into().unwrap(),
"Acme's repo",
@@ -629,7 +629,8 @@ mod tests {
.unwrap();
git::set_upstream(&original, "rad", "master", "refs/heads/master").unwrap();
let copy = checkout(id, remote_id, tempdir.path().join("copy"), &storage, false).unwrap();
let copy =
super::checkout(id, remote_id, tempdir.path().join("copy"), &storage, false).unwrap();
assert_eq!(
copy.head().unwrap().target(),
+1 -1
View File
@@ -793,5 +793,5 @@ where
#[cfg(test)]
mod tests {
#[test]
fn test_storage() {}
fn storage() {}
}
+2 -2
View File
@@ -1161,7 +1161,7 @@ mod tests {
use crate::test::fixtures;
#[test]
fn test_references_of() {
fn references_of() {
let tmp = tempfile::tempdir().unwrap();
let signer = SigningKey::mock(54);
let storage = Storage::open(tmp.path().join("storage"), fixtures::user()).unwrap();
@@ -1195,7 +1195,7 @@ mod tests {
}
#[test]
fn test_sign_refs() {
fn sign_refs() {
let tmp = tempfile::tempdir().unwrap();
let signer = SigningKey::mock(0xb4);
let storage = Storage::open(tmp.path(), fixtures::user()).unwrap();
@@ -106,7 +106,7 @@ mod test {
use super::*;
#[test]
fn test_url_parse() {
fn url_parse() {
let repo = RepoId::from_canonical("z2w8RArM3gaBXZxXhQUswE3hhLcss").unwrap();
let namespace =
Namespace::from_str("z6Mkifeb5NPS6j7JP72kEQEeuqMTpCAVcHsJi1C86jGTzHRi").unwrap();
@@ -142,7 +142,7 @@ mod test {
}
#[test]
fn test_url_to_string() {
fn url_to_string() {
let repo = RepoId::from_canonical("z2w8RArM3gaBXZxXhQUswE3hhLcss").unwrap();
let namespace =
Namespace::from_str("z6Mkifeb5NPS6j7JP72kEQEeuqMTpCAVcHsJi1C86jGTzHRi").unwrap();
@@ -108,7 +108,7 @@ mod test {
use super::*;
#[test]
fn test_url_parse() {
fn url_parse() {
let node = NodeId::from_str("z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK").unwrap();
let repo = RepoId::from_canonical("z2w8RArM3gaBXZxXhQUswE3hhLcss").unwrap();
let namespace =
+1 -1
View File
@@ -519,7 +519,7 @@ mod tests {
// to `london`. We expect that this does not cause the canonical head of the `london` repo
// to change, despite Bob being a delegate of both repos, because the refs were signed for the
// `paris` repo. We also don't expected the signed refs to validate without error.
fn test_rid_verification() {
fn rid_verification() {
let tmp = tempfile::tempdir().unwrap();
let alice = SigningKey::mock(9);
let bob = SigningKey::mock(10);
+6 -6
View File
@@ -135,7 +135,7 @@ mod test {
}
#[test]
fn test_assert_succeed() {
fn assert_succeed() {
let a = Foo::A(123);
assert_matches!(a, Foo::A(_));
@@ -166,7 +166,7 @@ mod test {
#[test]
#[should_panic]
fn test_assert_panic_0() {
fn assert_panic_0() {
let a = Foo::A(123);
assert_matches!(a, Foo::B(_));
@@ -174,7 +174,7 @@ mod test {
#[test]
#[should_panic]
fn test_assert_panic_1() {
fn assert_panic_1() {
let b = Foo::B("foo");
assert_matches!(b, Foo::B("bar"));
@@ -182,14 +182,14 @@ mod test {
#[test]
#[should_panic]
fn test_assert_panic_2() {
fn assert_panic_2() {
let b = Foo::B("foo");
assert_matches!(b, Foo::B(s) if s == "bar");
}
#[test]
fn test_assert_no_move() {
fn assert_no_move() {
let b = &mut Foo::A(0);
assert_matches!(*b, Foo::A(0));
}
@@ -226,7 +226,7 @@ mod test {
}
#[test]
fn test_panic_message() {
fn panic_message_format() {
let a = Foo::A(1);
// expr, pat
+1 -1
View File
@@ -38,7 +38,7 @@ mod test {
use super::*;
#[test]
fn test_version() {
fn version() {
let mut buffer = Vec::new();
Version {
name: "rad",