Skip to content

Commit 05a3a82

Browse files
committed
Add test for Type::cloexec
1 parent 7f65390 commit 05a3a82

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/socket.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,24 @@ fn set_cloexec() {
6363
assert_close_on_exec(&socket, false);
6464
}
6565

66+
#[cfg(all(
67+
feature = "all",
68+
any(
69+
target_os = "android",
70+
target_os = "dragonfly",
71+
target_os = "freebsd",
72+
target_os = "linux",
73+
target_os = "netbsd",
74+
target_os = "openbsd"
75+
)
76+
))]
77+
#[test]
78+
fn type_cloexec() {
79+
let ty = Type::Stream.cloexec();
80+
let socket = Socket::new(Domain::IPV4, ty, None).unwrap();
81+
assert_close_on_exec(&socket, true);
82+
}
83+
6684
/// Assert that `CLOEXEC` is set on `socket`.
6785
#[cfg(unix)]
6886
pub fn assert_close_on_exec<S>(socket: &S, want: bool)

0 commit comments

Comments
 (0)