• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 extern crate libloading;
2 
3 #[cfg(test)]
assert_send<T: Send>()4 fn assert_send<T: Send>() {}
5 #[cfg(test)]
assert_sync<T: Sync>()6 fn assert_sync<T: Sync>() {}
7 #[cfg(test)]
assert_display<T: std::fmt::Display>()8 fn assert_display<T: std::fmt::Display>() {}
9 
10 #[test]
check_error_send()11 fn check_error_send() {
12     assert_send::<libloading::Error>();
13 }
14 
15 #[test]
check_error_sync()16 fn check_error_sync() {
17     assert_sync::<libloading::Error>();
18 }
19 
20 #[test]
check_error_display()21 fn check_error_display() {
22     assert_display::<libloading::Error>();
23 }
24 
25 #[test]
check_library_send()26 fn check_library_send() {
27     assert_send::<libloading::Library>();
28 }
29 
30 #[cfg(unix)]
31 #[test]
check_unix_library_send()32 fn check_unix_library_send() {
33     assert_send::<libloading::os::unix::Library>();
34 }
35 
36 #[cfg(windows)]
37 #[test]
check_windows_library_send()38 fn check_windows_library_send() {
39     assert_send::<libloading::os::windows::Library>();
40 }
41 
42 #[test]
check_library_sync()43 fn check_library_sync() {
44     assert_sync::<libloading::Library>();
45 }
46 
47 #[cfg(unix)]
48 #[test]
check_unix_library_sync()49 fn check_unix_library_sync() {
50     assert_sync::<libloading::os::unix::Library>();
51 }
52 
53 #[cfg(windows)]
54 #[test]
check_windows_library_sync()55 fn check_windows_library_sync() {
56     assert_sync::<libloading::os::windows::Library>();
57 }
58 
59 #[test]
check_symbol_send()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]
check_unix_symbol_send()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]
check_windows_symbol_send()74 fn check_windows_symbol_send() {
75     assert_send::<libloading::os::windows::Symbol<fn() -> ()>>();
76 }
77 
78 #[test]
check_symbol_sync()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]
check_unix_symbol_sync()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]
check_windows_symbol_sync()93 fn check_windows_symbol_sync() {
94     assert_sync::<libloading::os::windows::Symbol<fn() -> ()>>();
95     // assert_not_sync::<libloading::os::windows::Symbol<*const ()>>();
96 }
97