Merge rust-bitcoin/rust-bitcoin#3884: units: Refactor Send/Sync api test

96f427a8b8 units: Refactor Send/Sync api test (Tobin C. Harding)

Pull request description:

  The `api` test for types implementing `Send` and `Sync` is part of both C-SEND-SYNC and also C-GOOD-ERR (for error types).

  Refactor the two tests into a single one and document appropriately. This is mirrors how we do it in `io/tests/api.rs`.

ACKs for top commit:
  apoelstra:
    ACK 96f427a8b84129179e86f3914be8e4712a89f660; successfully ran local tests; lgtm

Tree-SHA512: 7b24780ac2b4f73d0cad952555f005553d9b8c248da6f92c28e7e9510b58eba6c165720ded9bd2f2db19f9a19d72fe7dd333e68312f1291a47e044a94902be0b
This commit is contained in:
merge-script 2025-01-09 15:54:09 +00:00
commit d36ccea6c4
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
2 changed files with 10 additions and 10 deletions

View File

@ -129,12 +129,12 @@ fn api_all_non_error_types_have_non_empty_debug() {
assert!(!debug.is_empty());
}
// Types are `Send` and `Sync` where possible (C-SEND-SYNC).
#[test]
fn all_non_error_tyes_implement_send_sync() {
fn assert_send<T: Send>() {}
assert_send::<Types>();
fn assert_sync<T: Sync>() {}
// Types are `Send` and `Sync` where possible (C-SEND-SYNC).
assert_send::<Types>();
assert_sync::<Types>();
}

View File

@ -221,16 +221,16 @@ fn api_all_non_error_types_have_non_empty_debug() {
}
#[test]
fn send() {
fn all_types_implement_send_sync() {
fn assert_send<T: Send>() {}
assert_send::<Types>();
assert_send::<Errors>();
}
#[test]
fn sync() {
fn assert_sync<T: Sync>() {}
// Types are `Send` and `Sync` where possible (C-SEND-SYNC).
assert_send::<Types>();
assert_sync::<Types>();
// Error types should implement the Send and Sync traits (C-GOOD-ERR).
assert_send::<Errors>();
assert_sync::<Errors>();
}