| 1 |
extern crate libloading; |
| 2 |
|
| 3 |
#[cfg(test)] |
| 4 |
fn assert_send<T: Send>() {} |
| 5 |
#[cfg(test)] |
| 6 |
fn assert_sync<T: Sync>() {} |
| 7 |
#[cfg(test)] |
| 8 |
fn assert_display<T: std::fmt::Display>() {} |
| 9 |
|
| 10 |
#[test] |
| 11 |
fn check_error_send() { |
| 12 |
assert_send::<libloading::Error>(); |
| 13 |
} |
| 14 |
|
| 15 |
#[test] |
| 16 |
fn check_error_sync() { |
| 17 |
assert_sync::<libloading::Error>(); |
| 18 |
} |
| 19 |
|
| 20 |
#[test] |
| 21 |
fn check_error_display() { |
| 22 |
assert_display::<libloading::Error>(); |
| 23 |
} |
| 24 |
|
| 25 |
#[test] |
| 26 |
fn check_library_send() { |
| 27 |
assert_send::<libloading::Library>(); |
| 28 |
} |
| 29 |
|
| 30 |
#[cfg(unix)] |
| 31 |
#[test] |
| 32 |
fn check_unix_library_send() { |
| 33 |
assert_send::<libloading::os::unix::Library>(); |
| 34 |
} |
| 35 |
|
| 36 |
#[cfg(windows)] |
| 37 |
#[test] |
| 38 |
fn check_windows_library_send() { |
| 39 |
assert_send::<libloading::os::windows::Library>(); |
| 40 |
} |
| 41 |
|
| 42 |
#[test] |
| 43 |
fn check_library_sync() { |
| 44 |
assert_sync::<libloading::Library>(); |
| 45 |
} |
| 46 |
|
| 47 |
#[cfg(unix)] |
| 48 |
#[test] |
| 49 |
fn check_unix_library_sync() { |
| 50 |
assert_sync::<libloading::os::unix::Library>(); |
| 51 |
} |
| 52 |
|
| 53 |
#[cfg(windows)] |
| 54 |
#[test] |
| 55 |
fn check_windows_library_sync() { |
| 56 |
assert_sync::<libloading::os::windows::Library>(); |
| 57 |
} |
| 58 |
|
| 59 |
#[test] |
| 60 |
fn check_symbol_send() { |
| 61 |
assert_send::<libloading::Symbol<fn() -> ()>>(); |
| 62 |
// assert_not_send::<libloading::Symbol<*const ()>>(); |
| 63 |
} |
| 64 |
|
| 65 |
#[cfg(unix)] |
| 66 |
#[test] |
| 67 |
fn check_unix_symbol_send() { |
| 68 |
assert_send::<libloading::os::unix::Symbol<fn() -> ()>>(); |
| 69 |
// assert_not_send::<libloading::os::unix::Symbol<*const ()>>(); |
| 70 |
} |
| 71 |
|
| 72 |
#[cfg(windows)] |
| 73 |
#[test] |
| 74 |
fn check_windows_symbol_send() { |
| 75 |
assert_send::<libloading::os::windows::Symbol<fn() -> ()>>(); |
| 76 |
} |
| 77 |
|
| 78 |
#[test] |
| 79 |
fn check_symbol_sync() { |
| 80 |
assert_sync::<libloading::Symbol<fn() -> ()>>(); |
| 81 |
// assert_not_sync::<libloading::Symbol<*const ()>>(); |
| 82 |
} |
| 83 |
|
| 84 |
#[cfg(unix)] |
| 85 |
#[test] |
| 86 |
fn check_unix_symbol_sync() { |
| 87 |
assert_sync::<libloading::os::unix::Symbol<fn() -> ()>>(); |
| 88 |
// assert_not_sync::<libloading::os::unix::Symbol<*const ()>>(); |
| 89 |
} |
| 90 |
|
| 91 |
#[cfg(windows)] |
| 92 |
#[test] |
| 93 |
fn check_windows_symbol_sync() { |
| 94 |
assert_sync::<libloading::os::windows::Symbol<fn() -> ()>>(); |
| 95 |
// assert_not_sync::<libloading::os::windows::Symbol<*const ()>>(); |
| 96 |
} |