|
|
@ -713,10 +713,10 @@ mod tests { |
|
|
|
let limit = WebSocketConfig { max_message_size: Some(10), ..WebSocketConfig::default() }; |
|
|
|
let limit = WebSocketConfig { max_message_size: Some(10), ..WebSocketConfig::default() }; |
|
|
|
let mut socket = WebSocket::from_raw_socket(WriteMoc(incoming), Role::Client, Some(limit)); |
|
|
|
let mut socket = WebSocket::from_raw_socket(WriteMoc(incoming), Role::Client, Some(limit)); |
|
|
|
|
|
|
|
|
|
|
|
match socket.read_message() { |
|
|
|
assert!(matches!( |
|
|
|
Err(Error::Capacity(CapacityError::MessageTooLong { size: 13, max_size: 10 })) => {} |
|
|
|
socket.read_message(), |
|
|
|
_ => panic!(), |
|
|
|
Err(Error::Capacity(CapacityError::MessageTooLong { size: 13, max_size: 10 })) |
|
|
|
} |
|
|
|
)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#[test] |
|
|
|
#[test] |
|
|
@ -725,9 +725,9 @@ mod tests { |
|
|
|
let limit = WebSocketConfig { max_message_size: Some(2), ..WebSocketConfig::default() }; |
|
|
|
let limit = WebSocketConfig { max_message_size: Some(2), ..WebSocketConfig::default() }; |
|
|
|
let mut socket = WebSocket::from_raw_socket(WriteMoc(incoming), Role::Client, Some(limit)); |
|
|
|
let mut socket = WebSocket::from_raw_socket(WriteMoc(incoming), Role::Client, Some(limit)); |
|
|
|
|
|
|
|
|
|
|
|
match socket.read_message() { |
|
|
|
assert!(matches!( |
|
|
|
Err(Error::Capacity(CapacityError::MessageTooLong { size: 3, max_size: 2 })) => {} |
|
|
|
socket.read_message(), |
|
|
|
_ => panic!(), |
|
|
|
Err(Error::Capacity(CapacityError::MessageTooLong { size: 3, max_size: 2 })) |
|
|
|
} |
|
|
|
)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|