diff --git a/src/payload.rs b/src/payload.rs index 72f86e773..1e7427d3c 100644 --- a/src/payload.rs +++ b/src/payload.rs @@ -365,9 +365,22 @@ impl Inner { #[cfg(test)] mod tests { use super::*; + use std::io; use futures::future::{lazy, result}; use tokio_core::reactor::Core; + #[test] + fn test_error() { + let err: PayloadError = IoError::new(io::ErrorKind::Other, "ParseError").into(); + assert_eq!(err.description(), "ParseError"); + assert_eq!(err.cause().unwrap().description(), "ParseError"); + assert_eq!(format!("{}", err), "ParseError"); + + let err = PayloadError::Incomplete; + assert_eq!(err.description(), "A payload reached EOF, but is not complete."); + assert_eq!(format!("{}", err), "A payload reached EOF, but is not complete."); + } + #[test] fn test_basic() { Core::new().unwrap().run(lazy(|| { diff --git a/src/wsframe.rs b/src/wsframe.rs index efe0fc47c..3fd09ef4e 100644 --- a/src/wsframe.rs +++ b/src/wsframe.rs @@ -340,7 +340,7 @@ mod tests { assert!(Frame::parse(&mut buf).unwrap().is_none()); buf.extend(b"1"); let frame = Frame::parse(&mut buf).unwrap().unwrap(); - println!("FRAME: {:?}", frame); + println!("FRAME: {}", frame); assert!(!frame.finished); assert_eq!(frame.opcode, OpCode::Text); assert_eq!(frame.payload, &b"1"[..]);