1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-23 16:21:06 +01:00

more Body tests

This commit is contained in:
Nikolay Kim 2017-11-19 18:32:37 -10:00
parent 83862dfbb4
commit 766e243c63

View File

@ -205,6 +205,12 @@ impl From<Binary> for Frame {
mod tests {
use super::*;
#[test]
fn test_is_empty() {
assert_eq!(Binary::from("").is_empty(), true);
assert_eq!(Binary::from("test").is_empty(), false);
}
#[test]
fn test_static_str() {
assert_eq!(Binary::from("test").len(), 4);
@ -273,4 +279,20 @@ mod tests {
assert_eq!(Binary::from(&b).len(), 4);
assert_eq!(Binary::from(&b).as_ref(), "test".as_bytes());
}
#[test]
fn test_string() {
let b = "test".to_owned();
assert_eq!(Binary::from(b.clone()).len(), 4);
assert_eq!(Binary::from(b.clone()).as_ref(), "test".as_bytes());
assert_eq!(Binary::from(&b).len(), 4);
assert_eq!(Binary::from(&b).as_ref(), "test".as_bytes());
}
#[test]
fn test_bytes_mut() {
let b = BytesMut::from("test");
assert_eq!(Binary::from(b.clone()).len(), 4);
assert_eq!(Binary::from(b).as_ref(), "test".as_bytes());
}
}