@@ -8,11 +8,7 @@ fn connection_object_should_create_successfully() {
8
8
let _socket_connection = UnixSocketConnection :: new ( String :: from ( "socket_path" ) ) ;
9
9
}
10
10
11
- #[ test]
12
- fn should_connect ( ) -> Result < ( ) > {
13
- task:: block_on ( should_connect_async ( ) )
14
- }
15
-
11
+ #[ async_std:: test]
16
12
async fn should_connect_async ( ) -> Result < ( ) > {
17
13
// Setup to try and connect to socket server
18
14
let mut connection = UnixSocketConnection :: new ( String :: from ( "./temp-1.sock" ) ) ;
@@ -30,11 +26,7 @@ async fn should_connect_async() -> Result<()> {
30
26
Ok ( ( ) )
31
27
}
32
28
33
- #[ test]
34
- fn should_connect_and_send_data ( ) -> Result < ( ) > {
35
- task:: block_on ( should_connect_and_send_data_async ( ) )
36
- }
37
-
29
+ #[ async_std:: test]
38
30
async fn should_connect_and_send_data_async ( ) -> Result < ( ) > {
39
31
// Setup to try and connect to socket server
40
32
let mut connection = UnixSocketConnection :: new ( String :: from ( "./temp-2.sock" ) ) ;
@@ -62,11 +54,7 @@ async fn should_connect_and_send_data_async() -> Result<()> {
62
54
Ok ( ( ) )
63
55
}
64
56
65
- #[ test]
66
- fn should_connect_and_read_data ( ) -> Result < ( ) > {
67
- task:: block_on ( should_connect_and_read_data_async ( ) )
68
- }
69
-
57
+ #[ async_std:: test]
70
58
async fn should_connect_and_read_data_async ( ) -> Result < ( ) > {
71
59
// Setup to try and connect to socket server
72
60
let mut connection = UnixSocketConnection :: new ( String :: from ( "./temp-3.sock" ) ) ;
@@ -96,11 +84,7 @@ async fn should_connect_and_read_data_async() -> Result<()> {
96
84
Ok ( ( ) )
97
85
}
98
86
99
- #[ test]
100
- fn should_connect_and_send_data_from_cloned_sender ( ) -> Result < ( ) > {
101
- task:: block_on ( should_connect_and_send_data_from_cloned_sender_async ( ) )
102
- }
103
-
87
+ #[ async_std:: test]
104
88
async fn should_connect_and_send_data_from_cloned_sender_async ( ) -> Result < ( ) > {
105
89
// Setup to try and connect to socket server
106
90
let mut connection = UnixSocketConnection :: new ( String :: from ( "./temp-4.sock" ) ) ;
@@ -159,31 +143,18 @@ fn should_clone_write_sender_without_setup_and_panic() {
159
143
connection. clone_write_sender ( ) ;
160
144
}
161
145
162
- /*
163
- #[test]
146
+ #[ async_std:: test]
164
147
#[ should_panic]
165
- fn should_setup_connection_twice_and_panic() {
166
- let handle = std::thread::spawn(|| {
167
- task::block_on(should_setup_connection_twice_and_panic_async()).unwrap();
168
- })
169
- .join();
170
- task::block_on(remove_file("./temp-5.sock")).unwrap();
171
- handle.unwrap();
172
- }
173
-
174
- async fn should_setup_connection_twice_and_panic_async() -> Result<()> {
148
+ async fn should_setup_connection_twice_and_panic_async ( ) {
175
149
// Setup to try and connect to socket server
176
150
let mut connection = UnixSocketConnection :: new ( String :: from ( "./temp-5.sock" ) ) ;
177
151
178
152
// Listen for unix socket connections
179
- let socket = UnixListener::bind("./temp-5.sock").await? ;
153
+ let socket = UnixListener :: bind ( "./temp-5.sock" ) . await . unwrap ( ) ;
180
154
let mut incoming = socket. incoming ( ) ;
181
155
let ( _stream, result) = future:: join ( incoming. next ( ) , connection. setup_connection ( ) ) . await ;
182
156
result. unwrap ( ) ;
183
157
let ( _, result) = future:: join ( incoming. next ( ) , connection. setup_connection ( ) ) . await ;
184
158
result. unwrap ( ) ;
185
159
drop ( socket) ;
186
-
187
- Ok(())
188
160
}
189
- */
0 commit comments