units: Refactor Send/Sync api test

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 Send/Sync tests in both `units` and `io` and improve
comments.
This commit is contained in:
Tobin C. Harding 2025-01-08 14:08:41 +11:00
parent 4ade08c755
commit 96f427a8b8
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
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()); assert!(!debug.is_empty());
} }
// Types are `Send` and `Sync` where possible (C-SEND-SYNC).
#[test] #[test]
fn all_non_error_tyes_implement_send_sync() { fn all_non_error_tyes_implement_send_sync() {
fn assert_send<T: Send>() {} fn assert_send<T: Send>() {}
assert_send::<Types>();
fn assert_sync<T: Sync>() {} fn assert_sync<T: Sync>() {}
// Types are `Send` and `Sync` where possible (C-SEND-SYNC).
assert_send::<Types>();
assert_sync::<Types>(); assert_sync::<Types>();
} }

View File

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