diff options
Diffstat (limited to 'vendor/tokio/tests/tcp_socket.rs')
-rw-r--r-- | vendor/tokio/tests/tcp_socket.rs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/vendor/tokio/tests/tcp_socket.rs b/vendor/tokio/tests/tcp_socket.rs index 9258864d4..66309d304 100644 --- a/vendor/tokio/tests/tcp_socket.rs +++ b/vendor/tokio/tests/tcp_socket.rs @@ -1,6 +1,7 @@ #![warn(rust_2018_idioms)] -#![cfg(feature = "full")] +#![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi doesn't support bind +use std::time::Duration; use tokio::net::TcpSocket; use tokio_test::assert_ok; @@ -23,6 +24,7 @@ async fn basic_usage_v4() { } #[tokio::test] +#[cfg(not(tokio_no_ipv6))] async fn basic_usage_v6() { // Create server let addr = assert_ok!("[::1]:0".parse()); @@ -58,3 +60,16 @@ async fn bind_before_connect() { // Accept let _ = assert_ok!(srv.accept().await); } + +#[tokio::test] +async fn basic_linger() { + // Create server + let addr = assert_ok!("127.0.0.1:0".parse()); + let srv = assert_ok!(TcpSocket::new_v4()); + assert_ok!(srv.bind(addr)); + + assert!(srv.linger().unwrap().is_none()); + + srv.set_linger(Some(Duration::new(0, 0))).unwrap(); + assert_eq!(srv.linger().unwrap(), Some(Duration::new(0, 0))); +} |