mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-27 09:42:57 +01:00
payload error tests
This commit is contained in:
parent
1cdfea39f0
commit
4d93766a0f
@ -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(|| {
|
||||
|
@ -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"[..]);
|
||||
|
Loading…
Reference in New Issue
Block a user