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:
parent
4ade08c755
commit
96f427a8b8
|
@ -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>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue