Skip to content

Commit 5e5c046

Browse files
authored
Add a test for get_socket_nosigpipe. (#874)
1 parent 1a9d129 commit 5e5c046

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/net/sockopt.rs

+8
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,14 @@ fn test_sockopts_socket(s: &OwnedFd) {
177177
sockopt::set_socket_incoming_cpu(&s, 3).unwrap();
178178
assert_eq!(sockopt::get_socket_incoming_cpu(&s).unwrap(), 3);
179179
}
180+
181+
// Check the initial value of SO_NOSIGPIPE, set it, and check it.
182+
#[cfg(any(apple, freebsdlike, target_os = "netbsd"))]
183+
{
184+
assert_eq!(sockopt::get_socket_nosigpipe(&s).unwrap(), false);
185+
sockopt::set_socket_nosigpipe(&s, true).unwrap();
186+
assert_eq!(sockopt::get_socket_nosigpipe(&s).unwrap(), true);
187+
}
180188
}
181189

182190
// Test `tcp` socket options.

0 commit comments

Comments
 (0)