fix tests

This commit is contained in:
Rob Ede 2021-01-04 01:27:41 +00:00
parent 2858e8534a
commit 83ff4f38e1
No known key found for this signature in database
GPG Key ID: C2A3B36E841A91E6
5 changed files with 6 additions and 6 deletions

View File

@ -74,7 +74,7 @@ async fn service(msg: ws::Frame) -> Result<ws::Message, Error> {
let msg = match msg {
ws::Frame::Ping(msg) => ws::Message::Pong(msg),
ws::Frame::Text(text) => {
ws::Message::Text(String::from_utf8_lossy(&text).to_owned().into())
ws::Message::Text(String::from_utf8_lossy(&text).into_owned().into())
}
ws::Frame::Binary(bin) => ws::Message::Binary(bin),
ws::Frame::Continuation(item) => ws::Message::Continuation(item),

View File

@ -39,7 +39,7 @@ async fn test_simple() {
// client service
let mut framed = srv.ws().await.unwrap();
framed
.send(ws::Message::Text("text".to_string()))
.send(ws::Message::Text("text".into()))
.await
.unwrap();

View File

@ -76,7 +76,7 @@
//! .await?;
//!
//! connection
//! .send(awc::ws::Message::Text("Echo".to_string()))
//! .send(awc::ws::Message::Text("Echo".into()))
//! .await?;
//! let response = connection.next().await.unwrap()?;
//! # assert_eq!(response, awc::ws::Frame::Text("Echo".as_bytes().into()));

View File

@ -17,7 +17,7 @@
//! .unwrap();
//!
//! connection
//! .send(ws::Message::Text("Echo".to_string()))
//! .send(ws::Message::Text("Echo".into()))
//! .await
//! .unwrap();
//! let response = connection.next().await.unwrap().unwrap();

View File

@ -11,7 +11,7 @@ async fn ws_service(req: ws::Frame) -> Result<ws::Message, io::Error> {
match req {
ws::Frame::Ping(msg) => Ok(ws::Message::Pong(msg)),
ws::Frame::Text(text) => Ok(ws::Message::Text(
String::from_utf8(Vec::from(text.as_ref())).unwrap(),
String::from_utf8(Vec::from(text.as_ref())).unwrap().into(),
)),
ws::Frame::Binary(bin) => Ok(ws::Message::Binary(bin)),
ws::Frame::Close(reason) => Ok(ws::Message::Close(reason)),
@ -44,7 +44,7 @@ async fn test_simple() {
// client service
let mut framed = srv.ws().await.unwrap();
framed
.send(ws::Message::Text("text".to_string()))
.send(ws::Message::Text("text".into()))
.await
.unwrap();
let item = framed.next().await.unwrap().unwrap();