From 7e4a15446da369f4a4a140563eaadf3ccd290d8d Mon Sep 17 00:00:00 2001 From: Daniel Abramov Date: Wed, 12 Apr 2023 16:30:15 +0200 Subject: [PATCH] Properly activate features for examples and tests --- Cargo.toml | 24 ++++++++++++++++++++++++ tests/connection_reset.rs | 3 ++- tests/no_send_after_close.rs | 3 ++- tests/receive_after_init_close.rs | 3 ++- 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6640559..d33c2b3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -71,3 +71,27 @@ rand = "0.8.4" [[bench]] name = "buffer" harness = false + +[[example]] +name = "client" +required-features = ["handshake"] + +[[example]] +name = "server" +required-features = ["handshake"] + +[[example]] +name = "autobahn-client" +required-features = ["handshake"] + +[[example]] +name = "autobahn-server" +required-features = ["handshake"] + +[[example]] +name = "callback-error" +required-features = ["handshake"] + +[[example]] +name = "srv_accept_unmasked_frames" +required-features = ["handshake"] diff --git a/tests/connection_reset.rs b/tests/connection_reset.rs index 232c27e..40b7469 100644 --- a/tests/connection_reset.rs +++ b/tests/connection_reset.rs @@ -1,6 +1,7 @@ //! Verifies that the server returns a `ConnectionClosed` error when the connection //! is closed from the server's point of view and drop the underlying tcp socket. -#![cfg(any(feature = "native-tls", feature = "__rustls-tls"))] + +#![cfg(all(any(feature = "native-tls", feature = "__rustls-tls"), feature = "handshake"))] use std::{ net::{TcpListener, TcpStream}, diff --git a/tests/no_send_after_close.rs b/tests/no_send_after_close.rs index c19b1da..2182b92 100644 --- a/tests/no_send_after_close.rs +++ b/tests/no_send_after_close.rs @@ -1,6 +1,8 @@ //! Verifies that we can read data messages even if we have initiated a close handshake, //! but before we got confirmation. +#![cfg(feature = "handshake")] + use std::{ net::TcpListener, process::exit, @@ -8,7 +10,6 @@ use std::{ time::Duration, }; -#[cfg(feature = "handshake")] use tungstenite::{accept, connect, error::ProtocolError, Error, Message}; use url::Url; diff --git a/tests/receive_after_init_close.rs b/tests/receive_after_init_close.rs index 4a8e3a4..c8661c8 100644 --- a/tests/receive_after_init_close.rs +++ b/tests/receive_after_init_close.rs @@ -1,6 +1,8 @@ //! Verifies that we can read data messages even if we have initiated a close handshake, //! but before we got confirmation. +#![cfg(feature = "handshake")] + use std::{ net::TcpListener, process::exit, @@ -8,7 +10,6 @@ use std::{ time::Duration, }; -#[cfg(feature = "handshake")] use tungstenite::{accept, connect, Error, Message}; use url::Url;